[英]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.作为 Ubuntu 管理员,我想知道每个或最后一个傀儡代理运行的状态。 How can I check with cli?
如何使用 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. puppet 在 /var/lib/puppet/state/last_run_summary.yaml 中维护最后的 puppet 代理运行状态。 you can refer that yaml file content.
您可以参考该 yaml 文件内容。
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.要了解 puppet 代理上次在客户端服务器上运行的时间,
您可以使用以下命令 (
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 代理运行,则可以使用此 CLI 命令:
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.您也可以进行
dry
试。 Checkout Puppet noop
mode mode allows us to review the changes that Puppet would do on the system without actually applying them. Checkout Puppet
noop
模式允许我们查看 Puppet 在系统上所做的更改,而无需实际应用它们。 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 代码和数据推送到生产中!!
puppet agent -t --noop
Davendra's answer is great but the location has since changed. Davendra 的回答很好,但是位置已经改变了。 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}'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.