Nagios Tips and Tricks
mysql_health_check.pl - Command check_mysql-long-query
define command {
command_name check_mysql-long-query
command_line /usr/local/bin/mysql_health_check.pl --hostname $HOSTADDRESS$ --port $ARG1$ --user $USER3$ --password $USER4$ --cache_dir=/tmp --max_cache_age=900 --mode=long-query --warning=$ARG2$ --critical=$ARG3$
}
I've added authorization information in resource.cfg in the $USER3$ and $USER4$ macros. Our setup also has mysql servers on different ports, so we have to pass in the port into the command rather then being able to use the standard port everywhere.
I don't use the Ðcomparison argument because it seems broken to me. I can't seem to get it to work correctly, so I emulate it by using the same value for warning and critical.
I also quote the values with "", so if you have a " in your comparison, warning, or critical arguments, you'll have to escape it.
mysql_health_check.pl - Command check_mysql-locked-query
define command {
command_name check_mysql-locked-query
command_line /usr/local/bin/mysql_health_check.pl --hostname $HOSTADDRESS$ --port $ARG1$ --user $USER3$ --password $USER4$ --cache_dir=/tmp --max_cache_age=900 --mode=locked-query --warning=$ARG2$ --critical=$ARG3$
}
I've added authorization information in resource.cfg in the $USER3$ and $USER4$ macros. Our setup also has mysql servers on different ports, so we have to pass in the port into the command rather then being able to use the standard port everywhere.
I don't use the Ðcomparison argument because it seems broken to me. I can't seem to get it to work correctly, so I emulate it by using the same value for warning and critical.
I also quote the values with "", so if you have a " in your comparison, warning, or critical arguments, you'll have to escape it.
mysql_health_check.pl - Command check_mysql-varcomp
define command {
command_name check_mysql-varcomp
command_line /usr/local/bin/mysql_health_check.pl --hostname $HOSTADDRESS$ --port $ARG1$ --user $USER3$ --password $USER4$ --cache_dir=/tmp --max_cache_age=900 --mode=varcomp --expression="$ARG2$" --warning="$ARG3$" --critical="$ARG4$"
}
I've added authorization information in resource.cfg in the $USER3$ and $USER4$ macros. Our setup also has mysql servers on different ports, so we have to pass in the port into the command rather then being able to use the standard port everywhere.
I don't use the Ðcomparison argument because it seems broken to me. I can't seem to get it to work correctly, so I emulate it by using the same value for warning and critical.
I also quote the values with "", so if you have a " in your comparison, warning, or critical arguments, you'll have to escape it.
mysql_health_check.pl - Command check_mysql-comparison
define command {
command_name check_mysql-comparison
command_line /usr/local/bin/mysql_health_check.pl --hostname $HOSTADDRESS$ --port $ARG1$ --user $USER3$ --password $USER4$ --cache_dir=/tmp --max_cache_age=900 --mode=varcomp --expression="$ARG2$" --warning="$ARG3$" --critical="$ARG3$"
}
I've added authorization information in resource.cfg in the $USER3$ and $USER4$ macros. Our setup also has mysql servers on different ports, so we have to pass in the port into the command rather then being able to use the standard port everywhere.
I don't use the Ðcomparison argument because it seems broken to me. I can't seem to get it to work correctly, so I emulate it by using the same value for warning and critical.
I also quote the values with "", so if you have a " in your comparison, warning, or critical arguments, you'll have to escape it.
mysql_health_check.pl - Service - Check MySQL Clients Connected
define service{
use generic-service
host_name HostName
service_description MySQL - Clients Connected
check_command check_mysql-varcomp!3306!Threads_connected!>(max_connections*.75)!>(max_connections*.9)
}