From fdf148ef35708a883543bfad9213c212ea50ac06 Mon Sep 17 00:00:00 2001 From: Rene Zbinden Date: Thu, 7 Apr 2016 07:26:07 +0000 Subject: [PATCH] cleanup code, set dfltActivities in init() function, this leads to an if less in collect() method --- plugins/inputs/sysstat/sysstat.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/inputs/sysstat/sysstat.go b/plugins/inputs/sysstat/sysstat.go index aaf6e6dc5..973d484a0 100644 --- a/plugins/inputs/sysstat/sysstat.go +++ b/plugins/inputs/sysstat/sysstat.go @@ -174,9 +174,6 @@ func (s *Sysstat) Gather(acc telegraf.Accumulator) error { // Sadc -S -S ... 2 tmpFile // The above command collects system metrics during 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 { @@ -318,7 +315,8 @@ func escape(dirty string) string { func init() { inputs.Add("sysstat", func() telegraf.Input { return &Sysstat{ - Group: true, + Group: true, + Activities: dfltActivities, } }) }