From 0ad7ffc2eb6fd849fe084fa0f5f5ae6b2d2d73b7 Mon Sep 17 00:00:00 2001 From: Matteo Cerutti Date: Thu, 2 Feb 2017 12:24:29 +0100 Subject: [PATCH] Implemented requested changes --- plugins/inputs/ipmi_sensor/README.md | 11 ++++++++--- plugins/inputs/ipmi_sensor/ipmi.go | 10 +++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/plugins/inputs/ipmi_sensor/README.md b/plugins/inputs/ipmi_sensor/README.md index 836c6d7647243..bbac551370568 100644 --- a/plugins/inputs/ipmi_sensor/README.md +++ b/plugins/inputs/ipmi_sensor/README.md @@ -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: @@ -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 diff --git a/plugins/inputs/ipmi_sensor/ipmi.go b/plugins/inputs/ipmi_sensor/ipmi.go index 4b9a5eca5e02d..626a57e0b2f05 100644 --- a/plugins/inputs/ipmi_sensor/ipmi.go +++ b/plugins/inputs/ipmi_sensor/ipmi.go @@ -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 { @@ -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 {