Skip to content

Commit

Permalink
improve debug messages for check monitoring actions
Browse files Browse the repository at this point in the history
  • Loading branch information
itchyny committed Jul 20, 2018
1 parent d9e3082 commit e253f6e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions command/command.go
Expand Up @@ -415,10 +415,13 @@ func runChecker(checker *checks.Checker, checkReportCh chan *checks.Report, repo
if checker.Config.Action != nil {
env := []string{fmt.Sprintf("MACKEREL_STATUS=%s", report.Status), fmt.Sprintf("MACKEREL_PREVIOUS_STATUS=%s", lastStatus)}
go func() {
_, stderr, _, _ := checker.Config.Action.RunWithEnv(env)
logger.Debugf("Checker %q action: %q env: %+v", checker.Name, checker.Config.Action.CommandString(), env)
stdout, stderr, exitCode, _ := checker.Config.Action.RunWithEnv(env)

if stderr != "" {
logger.Warningf("Checker %q action output stderr: %s", checker.Name, stderr)
logger.Warningf("Checker %q action stdout: %q stderr: %q exitCode: %d", checker.Name, stdout, stderr, exitCode)
} else {
logger.Debugf("Checker %q action stdout: %q exitCode: %d", checker.Name, stdout, exitCode)
}
}()
}
Expand Down

0 comments on commit e253f6e

Please sign in to comment.