简体   繁体   English

如何显示上次 puppet 代理运行的摘要?

[英]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.

相关问题 无法从Puppet主服务器检索Puppet代理SSL证书 - Unable to retrieve Puppet agent SSL certificate from Puppet master 有什么方法可以在Puppet Agent中编译清单,自定义函数等? - Is there any way to compile Manifest, Custom Functions etc in Puppet Agent? 如何在人偶中获取哈希值中的密钥 - How to get key in hash value in puppet 如何在Puppet中使用模板配置文件 - How to use a template for configuration file in Puppet Puppet 7. 如何让多个配置文件订阅一些服务,其中单个配置文件由 Puppet 生成 - Puppet 7. How to let several profiles subscribe to some service of which the single config file is generated by Puppet 如何配置Eclipse始终启动上次运行配置,而不是当前文件? - How to configure Eclipse to always launch the last run configuration, not the current file? 如何在without主文件清单文件中没有节点输入的情况下配置p客户端? - How to Configure puppet client without node entry in the puppet master's manifest file? 如何使用Puppet在php.ini中设置config = value? - How to set config=value in php.ini with Puppet? 如何使用Puppet在服务启动时配置Docker守护程序 - How to use puppet to configure the docker daemon on service start up 如何使用 puppet 模块修改 SSH 配置文件 - How to modify a SSH configuration file using a puppet module
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM