Skip to content

Commit

Permalink
Implemented requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Matteo Cerutti committed Feb 2, 2017
1 parent 2b1e0b3 commit 0ad7ffc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
11 changes: 8 additions & 3 deletions plugins/inputs/ipmi_sensor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ Get bare metal metrics using the command line utility `ipmitool`

see ipmitool(https://sourceforge.net/projects/ipmitool/files/ipmitool/)

The plugin supports two modes. When 'servers' is not specified, the plugin will utilize the OpenIPMI kernel device driver to retrieve the sensor stats.
The plugin supports two modes. When 'servers' is not specified, the plugin will utilize the OpenIPMI kernel device driver to retrieve the sensor stats from
the local machine. The command to collect the local host sensor stats:

```
ipmitool sdr
```

When one or more servers are specified, the plugin will use the following command to collect remote host sensor stats:

Expand All @@ -30,12 +35,12 @@ The `server` tag will be made available when retrieving stats from remote server
## optionally specify the path to the ipmitool executable
## path = "/usr/bin/ipmitool"

## specify servers via a url matching:
## optionally specify one or more servers via a url matching. If servers is omitted, only the local machine sensor stats will be retrieved.
## [username[:password]@][protocol[(address)]]
## e.g.
## root:passwd@lan(127.0.0.1)
##
servers = ["USERID:PASSW0RD@lan(10.20.2.203)"]
## servers = ["USERID:PASSW0RD@lan(10.20.2.203)"]
```

## Output
Expand Down
10 changes: 7 additions & 3 deletions plugins/inputs/ipmi_sensor/ipmi.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@ type Ipmi struct {
}

var sampleConfig = `
## specify servers via a url matching:
## optionally specify the path to the ipmitool executable
## path = "/usr/bin/ipmitool"
## optionally specify one or more servers via a url matching. If servers is omitted, only the local machine sensor stats will be retrieved.
## [username[:password]@][protocol[(address)]]
## e.g.
## root:passwd@lan(127.0.0.1)
##
servers = ["USERID:PASSW0RD@lan(192.168.1.1)"]
## servers = ["USERID:PASSW0RD@lan(192.168.1.1)"]
`

func (m *Ipmi) SampleConfig() string {
Expand All @@ -41,7 +45,7 @@ func (m *Ipmi) Description() string {

func (m *Ipmi) Gather(acc telegraf.Accumulator) error {
if len(m.path) == 0 {
return errors.New("ipmitool not found: verify that ipmitool is installed and that ipmitool is in your PATH")
return fmt.Errorf("ipmitool not found: verify that ipmitool is installed and that ipmitool is in your PATH")
}

if len(m.Servers) > 0 {
Expand Down

0 comments on commit 0ad7ffc

Please sign in to comment.