cleanup code, set dfltActivities in init() function, this leads to an if less in collect() method

This commit is contained in:
Rene Zbinden 2016-04-07 07:26:07 +00:00 committed by Cameron Sparr
parent 797522e8ca
commit 7926396d2a
1 changed files with 2 additions and 4 deletions

View File

@ -174,9 +174,6 @@ func (s *Sysstat) Gather(acc telegraf.Accumulator) error {
// Sadc -S <Activity1> -S <Activity2> ... <collectInterval> 2 tmpFile
// The above command collects system metrics during <collectInterval> and saves it in binary form to tmpFile.
func (s *Sysstat) collect() error {
if len(s.Activities) == 0 {
s.Activities = dfltActivities
}
if len(s.Sadf) == 0 {
sadf, err := exec.LookPath("sadf")
if err != nil {
@ -319,6 +316,7 @@ func init() {
inputs.Add("sysstat", func() telegraf.Input {
return &Sysstat{
Group: true,
Activities: dfltActivities,
}
})
}