August Gerro
August Gerro

Reputation: 103

How to show a summary of the last puppet agent run?

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?

Upvotes: 4

Views: 15326

Answers (5)

vince
vince

Reputation: 1643

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 :)

Upvotes: 0

Bastion
Bastion

Reputation: 791

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}'

Upvotes: 4

Josh
Josh

Reputation: 1267

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

Upvotes: 0

Devendra Singh
Devendra Singh

Reputation: 136

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

Upvotes: 11

John
John

Reputation: 389

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.

Upvotes: 0

Related Questions