
thold alarms to Nagios plugin
Hi,
Cacti and Cacti plugins are very cool. I hope this is a good place to post this and please let me know if it's not.
I added some Nagios integration to thold. It adds the ability to send alarms to Nagios, either on the same system as Cacti or over NSCA to a remote system.
The attached file is a direct replacement for thold sub-directory in plugins for version "h". You should be able to move the original "h" version out of the way and put this one in. . There are several new files patterned after the original Email php class. Please give it a shot and if you like it, feel free to add it to the standard thold.
The Settings->thold tab has two switches for nagios, one for local and one for remote with NSCA. For local Nagios, you add a path to nagios.cmd. For remote, you need the path to send_nsca, it's configuration file and the remote server you want to send Nagios alarms.
You will need to create a host / service pair in Nagios configuration to get Nagios Notifications. The host name sent in the alarm is the first field of the Email subject. The service name is concatenated from the second Email alarm field and the first item in the last part of the subject. So an Email alarm with a subject like:
"Local switch - Traffic - 172.28.114.1 - Fa0/0 is still above threshold of 1000 with 1333.7472"
gives a service name of
"Traffic_Fa0/0"
This is easy to change. The last part of the subject is included in the status as the Nagios plugin message. The alarms go into Nagios as passive alarms.
One gotcha in this scheme is Nagios can get out-of-sync with Cacti's state. There needs to be a check_cacti plugin or something to periodically update Nagios. I haven't written this yet. The other option is to set up a volatile Nagios service so it's treated like log data. You get the notifications from Nagios but you need to go to Cacti to see what the state is. You can add links in Nagios services that pull up the alarm pages in Cacti.
Offloading network and other SNMP performance data to Cacti significantly reduces resource usage in Nagios, so this seems like a good deal.
What do you think?
Is this helpful?
Regards,
- Harper
Harper Mann
Groundwork Open Source
hmann@groundworkopensource.com