Skip to content

Commit

Permalink
Add last puppet run duration to perfdata
Browse files Browse the repository at this point in the history
  • Loading branch information
vStone committed Feb 7, 2020
1 parent 8552e0b commit 42a2559
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion puppet/check_puppet.rb
Expand Up @@ -28,6 +28,7 @@
running = false
lastrun_failed = false
lastrun = 0
lastrun_time = 0
failcount_resources = 0
failcount_events = 0
warn = 0
Expand Down Expand Up @@ -114,6 +115,7 @@
begin
summary = YAML.load_file(summaryfile)
lastrun = summary["time"]["last_run"]
lastrun_time = (summary["time"]["total"] || 0).round(2)

# machines that outright failed to run like on missing dependencies
# are treated as huge failures. The yaml file will be valid but
Expand Down Expand Up @@ -146,7 +148,7 @@
if disable_perfdata
perfdata_time = ""
else
perfdata_time = "|time_since_last_run=#{time_since_last_run}s;#{warn};#{crit};0 failed_resources=#{failcount_resources};;;0 failed_events=#{failcount_events};;;0"
perfdata_time = "|time_since_last_run=#{time_since_last_run}s;#{warn};#{crit};0 failed_resources=#{failcount_resources};;;0 failed_events=#{failcount_events};;;0 last_run_duration=#{lastrun_time};;;0"
end

unless failures
Expand Down

0 comments on commit 42a2559

Please sign in to comment.