diff options
| author | Brice Figureau <brice-puppet@daysofwonder.com> | 2010-11-12 13:39:41 +0100 |
|---|---|---|
| committer | Brice Figureau <brice-puppet@daysofwonder.com> | 2010-11-13 11:51:55 +0100 |
| commit | 4d31430275016c9abbd4f621e731ff2eeb1718e5 (patch) | |
| tree | a669aaf5018ff6b84121384d34d4cf9f017edf95 /spec/unit/transaction | |
| parent | 2b8e834fcbc548a221b4cd02ee7200fa4f6c2c78 (diff) | |
| download | puppet-4d31430275016c9abbd4f621e731ff2eeb1718e5.tar.gz puppet-4d31430275016c9abbd4f621e731ff2eeb1718e5.tar.xz puppet-4d31430275016c9abbd4f621e731ff2eeb1718e5.zip | |
Fix #4339 - Save a last run report summary to $statedir/last_run_summary.yaml
Once a configuration run is done, puppetd will save on the node a
yaml summary report roughly akin to:
---
time:
notify: 0.001025
last_run: 1289561427
schedule: 0.00071
config_retrieval: 0.039518
filebucket: 0.000126
resources:
changed: 1
total: 8
out_of_sync: 1
events:
total: 1
success: 1
changes:
total: 1
This is almost an hash version of the current --summarize output, with
the notable exception that the time section includes the last run unix
timestamp.
The whole idea is to be able to monitor locally if a puppetd does its job.
For instance this could be used in a nagios check or to send an SNMP trap.
The last_run information might help detect staleness, and this summary
can also be used for performance monitoring (ie time section).
The resource section can also show the number of failed resources.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'spec/unit/transaction')
| -rwxr-xr-x | spec/unit/transaction/report_spec.rb | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/spec/unit/transaction/report_spec.rb b/spec/unit/transaction/report_spec.rb index 7e0b0554b..b310713d2 100755 --- a/spec/unit/transaction/report_spec.rb +++ b/spec/unit/transaction/report_spec.rb @@ -225,8 +225,19 @@ describe Puppet::Transaction::Report do @report.calculate_metrics end - %w{Changes Total Resources}.each do |main| - it "should include information on #{main} in the summary" do + %w{changes time resources events}.each do |main| + it "should include the key #{main} in the raw summary hash" do + @report.raw_summary.should be_key main + end + end + + it "should include the last run time in the raw summary hash" do + Time.stubs(:now).returns(Time.utc(2010,11,10,12,0,24)) + @report.raw_summary["time"]["last_run"].should == 1289390424 + end + + %w{Changes Total Resources Time Events}.each do |main| + it "should include information on #{main} in the textual summary" do @report.summary.should be_include(main) end end |
