Repairer event_handler for Nagios (tm). --------------------------- This is set of event_handler for Nagios (subsys_event_handler), and snmpd addon (repairer), which is desined to automagically repair services (subsystems) on RedHat linux and derivatives. Nagios can be configured to execute subsys_event_handler for some services in following way: Add following to misccommands.cfg: -------- Cut here ------------- define command{ command_name subsys-event-handler command_line $USER2$/subsys_event_handler $HOSTNAME$ $HOSTADDRESS$ "$SERVICEDESC$" $SERVICESTATE$ $STATETYPE$ "$OUTPUT$" } -------- Cut here ------------- Then add following lines to descriptions of services you want (template-based config): -------- Cut here ------------- event_handler_enabled 1 event_handler subsys-event-handler -------- Cut here ------------- Then you need to specify write community for each monitored host. Just edit file /etc/nagios/subsys-comm.cfg (/etc/nagios is default config path in rpm-installed nagios). Note that hostnames have to be same as in nagios configs. Then edit file /etc/nagios/subsys-dep.cfg. Here you need to specify, which subsys (look in /etc/rc.d/init.d for them) have to be restarted on remote host, when service goes into HARD CRITICAL state. Read comments in the beginning of this file, and look on examples in it (hmm, it is just my working configuration :) ). Also you can edit /etc/nagios/subsys-ignore.cfg. It consists of lines of service check output, that are ignored at all. You can add your services to repair to file /etc/repairer/services.conf. Make sure that this file is the same on monitored hosts and NMS. OK, your nagios installation is ready to use it. Next, you need to extend snmp agent on host you monitoring with following lines (snmpd_addon): -------- Cut here ------------- com2sec repairer /32 group repairerRWGroup v1 repairer view repairer included .1.3.6.1.4.1.7088.3 access repairerRWGroup "" any noauth exact all repairer none pass .1.3.6.1.4.1.7088.3 /bin/sh /usr/bin/repairer -------- Cut here ------------- Repairer can optionally execute some pre-stop, post-stop, pre-start and post start scripts from directory /etc/repairer/. Look for examples there. OK, that's all. Restart snmpd on monitored hosts, and nagios on NMS. It should work. If it doesn't, look into code, correct it and send me a patch :) . Vladislav Bogdanov (slava@nsys.by) http://slava.local.nsys.by/projects/ Event handler requires SNMP_Session.pm and BER.pm from mrtg package and SMNP.pm from ucd_snmp to be installed. Nagios is a registered trademark of Ethan Galstad. THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.