Âü°í http://www.techthings.org/monitor-mysql-server-with-nagios/
Server
:: nagios »ç¿ëÀÚ»ý¼º
# CREATE USER 'nagios'@'localhost' IDENTIFIED BY '<password>';
# GRANT ALL PRIVILEGES ON *.* TO 'nagios'@'localhost';
# flush privileges;
:: processlist È®ÀÎ (¸ð´ÏÅ͸µ ±âÁØ)
# SELECT COUNT(*) FROM information_schema.processlist;
:: Nagios Server
# pwd
/usr/local/nagios/etc/servers
# cat xxxxx.cfg
..................
define service{
host_name xxxxxxxxx
service_description mysql-connection-time
max_check_attempts 1
check_interval 1
retry_interval 1
check_period 24x7
check_freshness 1
contact_groups admins
notification_interval 1
notification_period 24x7
notifications_enabled 1
register 1
}
# service nagios restart
Client
# /usr/local/nagios/libexec/check_mysql_health --hostname localhost --user nagios --password <PASSWORD> --mode threads-connected
CRITICAL - 429 client connection threads | 'threads_connected'=429;10;20;;
check_mysql_health ÆÄÀϼöÁ¤
............................
3661 if ($self->mode =~ /server::instance::connectedthreads/) {
3662 $self->get_check_status_var('threads_connected', 'Threads_connected',
3663 450, 900, '%d client connection threads');
# /usr/local/nagios/libexec/check_mysql_health --hostname localhost --user nagios --password <PASSWORD> --mode threads-connected
OK - 432 client connection threads | 'threads_connected'=432;450;900;;