parent
c3dad00c1b
commit
3192c78d96
|
@ -17,6 +17,7 @@ of metrics collected and from how many plugins.
|
||||||
- [#244](https://github.com/influxdb/telegraf/pull/244): netstat plugin, thanks @shirou!
|
- [#244](https://github.com/influxdb/telegraf/pull/244): netstat plugin, thanks @shirou!
|
||||||
- [#262](https://github.com/influxdb/telegraf/pull/262): zookeeper plugin, thanks @jrxFive!
|
- [#262](https://github.com/influxdb/telegraf/pull/262): zookeeper plugin, thanks @jrxFive!
|
||||||
- [#237](https://github.com/influxdb/telegraf/pull/237): statsd service plugin, thanks @sparrc
|
- [#237](https://github.com/influxdb/telegraf/pull/237): statsd service plugin, thanks @sparrc
|
||||||
|
- [#273](https://github.com/influxdb/telegraf/pull/273): puppet agent plugin, thats @jrxFive!
|
||||||
|
|
||||||
### Bugfixes
|
### Bugfixes
|
||||||
- [#228](https://github.com/influxdb/telegraf/pull/228): New version of package will replace old one. Thanks @ekini!
|
- [#228](https://github.com/influxdb/telegraf/pull/228): New version of package will replace old one. Thanks @ekini!
|
||||||
|
|
|
@ -182,6 +182,7 @@ Telegraf currently has support for collecting metrics from
|
||||||
* postgresql
|
* postgresql
|
||||||
* procstat
|
* procstat
|
||||||
* prometheus
|
* prometheus
|
||||||
|
* puppetagent
|
||||||
* rabbitmq
|
* rabbitmq
|
||||||
* redis
|
* redis
|
||||||
* rethinkdb
|
* rethinkdb
|
||||||
|
|
|
@ -2,12 +2,13 @@ package puppetagent
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/influxdb/telegraf/plugins"
|
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/influxdb/telegraf/plugins"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PuppetAgent is a PuppetAgent plugin
|
// PuppetAgent is a PuppetAgent plugin
|
||||||
|
@ -57,7 +58,7 @@ type time struct {
|
||||||
Exec float64 `yaml:"exec"`
|
Exec float64 `yaml:"exec"`
|
||||||
Anchor float64 `yaml:"anchor"`
|
Anchor float64 `yaml:"anchor"`
|
||||||
SSHAuthorizedKey float64 `yaml:"ssh_authorized_key"`
|
SSHAuthorizedKey float64 `yaml:"ssh_authorized_key"`
|
||||||
Service float64 `yaml:"server"`
|
Service float64 `yaml:"service"`
|
||||||
Package float64 `yaml:"package"`
|
Package float64 `yaml:"package"`
|
||||||
Total float64 `yaml:"total"`
|
Total float64 `yaml:"total"`
|
||||||
ConfigRetrieval float64 `yaml:"config_retrieval"`
|
ConfigRetrieval float64 `yaml:"config_retrieval"`
|
||||||
|
|
|
@ -14,32 +14,61 @@ func TestGather(t *testing.T) {
|
||||||
}
|
}
|
||||||
pa.Gather(&acc)
|
pa.Gather(&acc)
|
||||||
|
|
||||||
assert.True(t, acc.HasIntValue("events_failure"))
|
checkInt := []struct {
|
||||||
assert.True(t, acc.HasIntValue("events_total"))
|
name string
|
||||||
assert.True(t, acc.HasIntValue("events_success"))
|
value int64
|
||||||
assert.True(t, acc.HasIntValue("resources_failed"))
|
}{
|
||||||
assert.True(t, acc.HasIntValue("resources_scheduled"))
|
{"events_failure", 0},
|
||||||
assert.True(t, acc.HasIntValue("resources_changed"))
|
{"events_total", 0},
|
||||||
assert.True(t, acc.HasIntValue("resources_skipped"))
|
{"events_success", 0},
|
||||||
assert.True(t, acc.HasIntValue("resources_total"))
|
{"resources_failed", 0},
|
||||||
assert.True(t, acc.HasIntValue("resources_failedtorestart"))
|
{"resources_scheduled", 0},
|
||||||
assert.True(t, acc.HasIntValue("resources_restarted"))
|
{"resources_changed", 0},
|
||||||
assert.True(t, acc.HasIntValue("resources_outofsync"))
|
{"resources_skipped", 0},
|
||||||
assert.True(t, acc.HasIntValue("changes_total"))
|
{"resources_total", 109},
|
||||||
|
{"resources_failedtorestart", 0},
|
||||||
assert.True(t, acc.HasIntValue("time_lastrun"))
|
{"resources_restarted", 0},
|
||||||
assert.True(t, acc.HasIntValue("version_config"))
|
{"resources_outofsync", 0},
|
||||||
|
{"changes_total", 0},
|
||||||
assert.True(t, acc.HasFloatValue("time_user"))
|
{"time_lastrun", 1444936531},
|
||||||
assert.True(t, acc.HasFloatValue("time_schedule"))
|
{"version_config", 1444936521},
|
||||||
assert.True(t, acc.HasFloatValue("time_filebucket"))
|
}
|
||||||
assert.True(t, acc.HasFloatValue("time_file"))
|
|
||||||
assert.True(t, acc.HasFloatValue("time_exec"))
|
for _, c := range checkInt {
|
||||||
assert.True(t, acc.HasFloatValue("time_anchor"))
|
assert.Equal(t, true, acc.CheckValue(c.name, c.value))
|
||||||
assert.True(t, acc.HasFloatValue("time_sshauthorizedkey"))
|
}
|
||||||
assert.True(t, acc.HasFloatValue("time_service"))
|
|
||||||
assert.True(t, acc.HasFloatValue("time_package"))
|
checkFloat := []struct {
|
||||||
assert.True(t, acc.HasFloatValue("time_total"))
|
name string
|
||||||
assert.True(t, acc.HasFloatValue("time_configretrieval"))
|
value float64
|
||||||
assert.True(t, acc.HasFloatValue("time_cron"))
|
}{
|
||||||
|
{"time_user", 0.004331},
|
||||||
|
{"time_schedule", 0.001123},
|
||||||
|
{"time_filebucket", 0.000353},
|
||||||
|
{"time_file", 0.441472},
|
||||||
|
{"time_exec", 0.508123},
|
||||||
|
{"time_anchor", 0.000555},
|
||||||
|
{"time_sshauthorizedkey", 0.000764},
|
||||||
|
{"time_service", 1.807795},
|
||||||
|
{"time_package", 1.325788},
|
||||||
|
{"time_total", 8.85354707064819},
|
||||||
|
{"time_configretrieval", 4.75567007064819},
|
||||||
|
{"time_cron", 0.000584},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, f := range checkFloat {
|
||||||
|
assert.Equal(t, true, acc.CheckValue(f.name, f.value))
|
||||||
|
}
|
||||||
|
|
||||||
|
checkString := []struct {
|
||||||
|
name string
|
||||||
|
value string
|
||||||
|
}{
|
||||||
|
{"version_puppet", "3.7.5"},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, s := range checkString {
|
||||||
|
assert.Equal(t, true, acc.CheckValue(s.name, s.value))
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue