Oleksandr Lytvyn
06/23/2023, 10:02 AMpuppet agent --disable "Reason XYZ"
For case when agent is disabled we've previously used "Monit" (service was running from root) which was checking last modification timestamp of the file /opt/puppetlabs/puppet/cache/state/last_run_report.yaml
/etc/monit$ cat conf-enabled/puppetagent.monit
### THIS FILE IS MANAGED BY PUPPET. ANY MANUAL CHANGES WILL GET OVERWRITTEN.
check file last_puppet_run with path /opt/puppetlabs/puppet/cache/state/last_run_report.yaml
if mtime older than 1440 minutes then exec "/etc/monit/conf-enabled/slack_bad.sh"
We tried to try to replicate what Monit was doing in Zabbix and Prometheus node exporter, but because of the permissions of this file Zabbix and Prometheus node exporter are not able to check timestamp of this file
ls -l /opt/puppetlabs/puppet/cache/state/last_run_report.yaml
-rw-r----- 1 root root 284420 Jun 23 09:46 /opt/puppetlabs/puppet/cache/state/last_run_report.yaml
What is the proper way to cover use case when agent is disabled?
Thanks