Reload nagios3 if generated resources are changed

I like puppet exported resources to manage nagios and icinga configurations. It’s pretty cool and I never have to care about nagios checks. Are all checks added to that host? What check is missing.

But if you use puppet 2.7.X like I do, some handy settings are missing. Therefore it is not possible to notify nagios service if the main exported resources are changed. Something like:

Nagios_host <<||>>{
    notify => Service['nagios3'],

is not working. But how can I reload/restart nagios3 if my generated services/hosts are changed.

I added a cronjob which runs every 30 min to reload nagios3 if the generated service-checks file gets an update. Therefore I only use one big file /etc/nagios3/generated-service-checks.cfg to handle all service checks out of puppet exported resources.

The cronjob checks every 30 min if the file has changed the last 30 min and if it has changed, it reloads nagios3.

find /etc/nagios3/ -type f -iname generated-service-checks.cfg -mmin -30 -exec /etc/init.d/nagios3 reload \;'

That’s it.

comments powered by Disqus