As Ubuntu administrator I want to know status of each or last puppet agent run. How can I check with cli? Can I write to logs each run in human readable format?
-
With a cli: no. There are files on the master that store the last run info and messages on the client has the output, but people generally set up reporters for this. – Matthew Schuchard Oct 09 '17 at 12:12
5 Answers
puppet maintain last puppet agent run status in /var/lib/puppet/state/last_run_summary.yaml. you can refer that yaml file content.
To know when puppet agent last ran on client server you can check timestamp
of that file via using below command (stat
) or your preferred any other command.
stat /var/lib/puppet/state/last_run_summary.yaml

- 19,910
- 6
- 56
- 65

- 146
- 2
- 5
-
5An up-to-date answer would be. ```cat /opt/puppetlabs/puppet/cache/state/last_run_report.yaml``` – 16c7x Jun 02 '21 at 22:56
-
Thanks! As per @16c7x the location has changed a little. The command I ran for my reports is: stat -c %y /opt/puppetlabs/puppet/cache/state/last_run_summary.yaml | awk '{print $1}' – Bastion Sep 09 '22 at 02:34
Davendra's answer is great but the location has since changed. To check the last run time use:
stat -c %y /opt/puppetlabs/puppet/cache/state/last_run_summary.yaml"
For reporting - if you just want the date (and not the time) you can use:
stat -c %y /opt/puppetlabs/puppet/cache/state/last_run_summary.yaml" | awk '{print $1}'

- 761
- 10
- 10
If you are fine with running a new puppet agent run you can use this CLI command:
puppet agent --test --summarize
This prints a nice summary at the end of the output of the command.

- 349
- 4
- 3
You can also do a dry
test. Checkout Puppet noop
mode mode allows us to review the changes that Puppet would do on the system without actually applying them. This is particularly useful when managing critical servers, as it allows to push to production Puppet code and data in a more controlled, safe and manageable way!!
puppet agent -t --noop

- 1,059
- 10
- 17
You can run
cat /opt/puppetlabs/puppet/cache/state/last_run_report.yaml
use stat
instead of cat
and check the timestamp to see when the last run was.
/var/lib/puppet/state/last_run_summary.yaml
is outdated now
hope this helps :)

- 765
- 3
- 14