Ask Your Question
0

How to restart Icinga after exported ressources have been removed?

asked 2015-08-05 05:36:59 -0500

Sebastian gravatar image

I use exported resources heavily for my monitoring. The relevant parts in the manifest for my Icinga hosts look like this:

resources {
    [ "nagios_service", "nagios_host", "nagios_hostgroup" ]:
      purge => true,
      notify => Service["icinga"],
}
Nagios_host <<| |>> {
    notify => Service["icinga"],
}
Nagios_service <<| |>> {
    notify => Service["icinga"],
}

If new hosts or services are added or changed, the resources on Icinga are changed and Icinga is restarted as expected.

If a host is deactivated via

puppet node deactivate $hostname
puppet cert clean $hostname

The resources on Icinga are removed, but Icinga is not restarted.

How to restart Icinga in such cases?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2017-01-24 10:20:25 -0500

Sebastian gravatar image

In the end, I solved this using monit:

check process icinga
      with pidfile "/var/run/icinga/icinga.pid"
      start program = "/etc/init.d/icinga start"
      stop program = "/etc/init.d/icinga stop"
      if 3 restarts within 3 cycles then alert
check file nagios_command with path /etc/nagios/nagios_command.cfg
      if changed checksum then exec "/etc/init.d/icinga reload"
check file nagios_host with path /etc/nagios/nagios_host.cfg
      if changed checksum then exec "/etc/init.d/icinga reload"
check file nagios_service with path /etc/nagios/nagios_service.cfg
      if changed checksum then exec "/etc/init.d/icinga reload"
edit flag offensive delete link more
0

answered 2015-08-06 22:43:58 -0500

GregLarkin gravatar image

I don't use Nagios or Icinga, but is there a directory where a config file or files are stored and rewritten when a host is added or deleted?

I wonder if there's a way that you can construct a list of all active nodes in a separate file and then have that file notify the service? That file would be guaranteed to change when hosts are added or deleted, and the refresh event should trigger.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-08-05 05:32:31 -0500

Seen: 209 times

Last updated: Jan 24