Clarify platform support for temp input (#4756)

This commit is contained in:
Daniel Nelson 2018-09-26 19:05:55 -07:00 committed by GitHub
parent 74e9d1f078
commit 38e5e103ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 16 deletions

View File

@ -1,6 +1,9 @@
# Temp Input plugin # Temp Input plugin
This input plugin collect temperature. The temp input plugin gather metrics on system temperature. This plugin is
meant to be multi platform and uses platform specific collection methods.
Currently supports Linux and Windows.
### Configuration: ### Configuration:
@ -8,25 +11,19 @@ This input plugin collect temperature.
[[inputs.temp]] [[inputs.temp]]
``` ```
### Measurements & Fields: ### Metrics:
All fields are float64. - temp
- tags:
- temp ( unit: °Celsius)
### Tags:
- All measurements have the following tags:
- host
- sensor - sensor
- fields:
- temp (float, celcius)
### Example Output: ### Example Output:
``` ```
$ ./telegraf --config telegraf.conf --input-filter temp --test temp,sensor=coretemp_physicalid0_crit temp=100 1531298763000000000
* Plugin: temp, Collection 1 temp,sensor=coretemp_physicalid0_critalarm temp=0 1531298763000000000
> temp,host=localhost,sensor=coretemp_physicalid0_crit temp=100 1531298763000000000 temp,sensor=coretemp_physicalid0_input temp=100 1531298763000000000
> temp,host=localhost,sensor=coretemp_physicalid0_critalarm temp=0 1531298763000000000 temp,sensor=coretemp_physicalid0_max temp=100 1531298763000000000
> temp,host=localhost,sensor=coretemp_physicalid0_input temp=100 1531298763000000000
> temp,host=localhost,sensor=coretemp_physicalid0_max temp=100 1531298763000000000
``` ```

View File

@ -2,6 +2,7 @@ package temp
import ( import (
"fmt" "fmt"
"strings"
"github.com/influxdata/telegraf" "github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/inputs" "github.com/influxdata/telegraf/plugins/inputs"
@ -25,6 +26,9 @@ func (t *Temperature) SampleConfig() string {
func (t *Temperature) Gather(acc telegraf.Accumulator) error { func (t *Temperature) Gather(acc telegraf.Accumulator) error {
temps, err := t.ps.Temperature() temps, err := t.ps.Temperature()
if err != nil { if err != nil {
if strings.Contains(err.Error(), "not implemented yet") {
return fmt.Errorf("plugin is not supported on this platform: %v", err)
}
return fmt.Errorf("error getting temperatures info: %s", err) return fmt.Errorf("error getting temperatures info: %s", err)
} }
for _, temp := range temps { for _, temp := range temps {