简体   繁体   中英

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?

puppet maintain last puppet agent run status in /var/lib/puppet/state/last_run_summary.yaml. you can refer that yaml file content. of that file via using below command ( stat ) or your preferred any other command.使用以下命令 ( stat ) 或您喜欢的任何其他命令该文件的

stat /var/lib/puppet/state/last_run_summary.yaml

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.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM