From 6c0ea7b743f1ed9edc3da89f06f7118b88a40b2c Mon Sep 17 00:00:00 2001 From: Rene Zbinden Date: Tue, 29 Mar 2016 22:22:38 +0200 Subject: [PATCH] fix race condition --- plugins/inputs/sysstat/sysstat.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/inputs/sysstat/sysstat.go b/plugins/inputs/sysstat/sysstat.go index 2b605b3ad..e87ec1f41 100644 --- a/plugins/inputs/sysstat/sysstat.go +++ b/plugins/inputs/sysstat/sysstat.go @@ -175,6 +175,13 @@ 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 { + return errors.New("sadf not in $PATH, configure path to sadf") + } + s.Sadf = sadf + } options := []string{} for _, act := range s.Activities { options = append(options, "-S", act) @@ -194,13 +201,6 @@ func (s *Sysstat) collect() error { // Sadf -p -- -p