nagios监控mysql
一般的监控内容nagios都自带了监控程序,比如mysql等,也有一些网上可以去下载,比较特殊的才需要自己写,一般我们自己定义的监控能处理比较特殊的监控。这里只记录了一个常用的mysql的配置。mysql 的监控主要通过check_mysql命令(nagios自带),首先测试下命令
/usr/local/nagios/libexec/check_mysql -H 192.168.AAA.BBB -u USER -p YOURPASSWORD报错:/usr/local/nagios/libexec/check_mysql: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
解决:这个动态库一般在安装mysql的时候都是已经有的,查找下,然后在/usr/lib64下做个连接ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/配置命令commands.cfg#check mysql
define command{
command_name check_mysql
command_line $USER1$/check_mysql -H $HOSTADDRESS$ -uUSER -p YOURPASSWORD
} 如果host中没有的,要现在hosts.fg中先登记下define service {
host_name slave144
service_description MysqlDB
check_period 24x7
max_check_attempts 2
normal_check_interval 1
retry_check_interval 1
contact_groups dbagroup
notification_interval 5
notification_period 24x7
notification_options w,u,c,r
check_command check_mysql
}
define service {
host_name slave145
service_description MysqlDB
check_period 24x7
max_check_attempts 2
normal_check_interval 1
retry_check_interval 1
contact_groups sagroup,dbagroup
notification_interval 5
notification_period 24x7
notification_options w,u,c,r
check_command check_mysql
}
define servicegroup{
servicegroup_name Mysql-service-group
alias NA
members slave144, MysqlDB,slave145, MysqlDB
}检查下配置是否有问题/usr/local/nagios/bin/nagios
-v /usr/local/nagios/etc/nagios.cfg有问题会提示错误信息重启下service nagios restart
文章来源:新浪博客沧海大声啸作者:kervin(博为峰网校金牌讲师)
页:
[1]