Skip to content

Commit

Permalink
ipmi_sensor support connecting locally rather than via TCP influxdata…
Browse files Browse the repository at this point in the history
  • Loading branch information
Matteo Cerutti committed Jan 9, 2017
1 parent 4b08d12 commit 5202474
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
6 changes: 5 additions & 1 deletion plugins/inputs/ipmi_sensor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ Get bare metal metrics using the command line utility `ipmitool`

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

The plugin will use the following command to collect remote host sensor stats:
The plugin can work with two type of interfaces: open, lan.

When the interface is 'open', the ipmitool utilizes the OpenIPMI kernel device driver to retrieve the sensor stats.

If you set the interface to 'lan', the plugin will use the following command to collect remote host sensor stats:

ipmitool -I lan -H 192.168.1.1 -U USERID -P PASSW0RD sdr

Expand Down
21 changes: 12 additions & 9 deletions plugins/inputs/ipmi_sensor/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,21 @@ func NewConnection(server string) *Connection {
func (t *Connection) options() []string {
intf := t.Interface
if intf == "" {
intf = "lan"
intf = "open"
}

options := []string{
"-H", t.Hostname,
"-U", t.Username,
"-P", t.Password,
"-I", intf,
}
switch intf {
case "lan":
options := []string{
"-H", t.Hostname,
"-U", t.Username,
"-P", t.Password,
"-I", intf
}

if t.Port != 0 {
options = append(options, "-p", strconv.Itoa(t.Port))
if t.Port != 0 {
options = append(options, "-p", strconv.Itoa(t.Port))
}
}

return options
Expand Down

0 comments on commit 5202474

Please sign in to comment.