in Settings -> alerting threshold added a "Nagios Notification Options" where you specify :
* a checkbox to enable the module or not
* Nagios Script where you specify a path to a script cacti will run when an a threshold is... thresholded
This way you can also change this script to do whatever you want.
Then, in the threshold page of every datasource, you can add (or not) in a Nagios module :
*Nagios Host Name : the name of the host you defines in Nagios
*Nagios Service Name : The service name defined in Nagios and attached to the host defined above.
Then you add a passive check in nagios like this :
Code: Select all
define service{
use generic-service ; Name of service template to use
host_name encoder-tmp
service_description ENCODER-TMP_ENCODER_PROCESS
is_volatile 0
check_period 24x7
max_check_attempts 1
normal_check_interval 5
retry_check_interval 1
contact_groups admins
notification_options w,u,c,r
notification_interval 960
notification_period 24x7
active_checks_enabled 0
check_command check_dummy
}
Code: Select all
Nagios Host Name : encoder-tmp
Nagios Service Name : ENCODER-TMP_ENCODER_PROCESS
Code: Select all
> cat /opt/monitor/scripts/cacti-to-nagios.sh
#!/bin/sh
# this script copy the data in argument to the Nagios external command file
NAGIOS_FILE="/opt/monitor/nagios/var/rw/nagios.cmd"
echo $1 >> ${NAGIOS_FILE}
exit 0
When the threshold is reached, an entry is added to the passive check file in Nagios.
I have this working for few months now, so I think it is working well
I may give a diff file if someone is interested, and if someone want to add this to the official source.
Of course, this can be extended to work with any software, not only Nagios, and can easily be adapted to directly send the message by SMS.