Skip to content

Commit

Permalink
Merge pull request #510 from mackerelio/check-action-debug
Browse files Browse the repository at this point in the history
Improve debug messages for check monitoring actions
  • Loading branch information
itchyny authored Jul 20, 2018
2 parents 338a932 + e253f6e commit 47e2812
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions command/command.go
Original file line number Diff line number Diff line change
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 47e2812

Please sign in to comment.