js333 > 计算机互联网 > 金沙js333娱乐场:Nagios监控mysql服务器详细实现过

原标题:金沙js333娱乐场:Nagios监控mysql服务器详细实现过

浏览次数:192 时间:2019-11-05

Nagios报警时间间隔的配置

1,监控插件下载

Nagios监控mysql服务器详细实现过程

 

host_name:必须是主机配置文件hosts.cfg中定义的主机。

Mongodb插件下载地址为:git clone git://github.com/mzupan/nagios-plugin-mongodb.git,刚开始本人这里没有安装gitpub环境,找网友帮忙下载的,之后上传到了Linux公社资源网站,新的下载地址为:

1、NRPE介绍

NRPE是Nagios的一个功能扩展,它可在远程Linux/Unix主机上执行插件程序。通过在远程服务器上安装NRPE插件及Nagios插件程序来向Nagios监控平台提供该服务器的本地情况,如CPU负载,内存使用,磁盘使用等。这里将Nagios监控端称为Nagios服务器端,而将远程被监控的主机称为Nagios客户端。

Nagios监控远程主机的方法有多种,其方式包括SNMP,NRPE,SSH,NCSA等。这里介绍其通过NRPE监控远程Linux主机的方式。

NRPE(Nagios Remote Plugin Executor)是用于在远端服务器上运行监测命令的守护进程,它用于让Nagios监控端基于安装的方式触发远端主机上的检测命令,并将检测结果返回给监控端。而其执行的开销远低于基于SSH的检测方式,而且检测过程不需要远程主机上的系统账号信息,其安全性也高于SSH的检测方式。

 

check_command:在commands.cfg文件中定义或在nrpe.cfg里面定义的命令;

------------------------------------------分割线------------------------------------------

2、NRPE的工作原理

NRPE有两部分组成

check_nrpe插件:位于监控主机上

nrpe daemon:运行在远程主机上,通常是被监控端agent

注意:nrpe daemon需要Nagios-plugins插件的支持,否则daemon不能做任何监控

当Nagios需要监控某个远程Linux主机的服务或者资源情况时:

首先:Nagios会运行check_nrpe这个插件,告诉它要检查什么;

其次:check_nrpe插件会连接到远程的NRPE daemon,所用的方式是SSL;

然后:NRPE daemon 会运行相应的Nagios插件来执行检查;

最后:NRPE daemon 将检查的结果返回给check_nrpe 插件,插件将其递交给nagios做处理。

 

<版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!>
原博客地址:
原作者:黄杉 (mchdba)

 

max_check_attempts: 最大重试次数,一般设置为4次左右;

免费下载地址在

3、被监控端安装Nagios-plugins插件和NRPE

去mysql客户端安装nrpe客户端服务

normal_check_interval 和retry_check_interval检查间隔的单位是分钟。

用户名与密码都是www.linuxidc.com

3.1、添加nagios用户

[[email protected] ~]# useradd -s/sbin/nologin nagios

 

notification_interval  通知间隔指探测到故障后,每隔多长时间发送一次报警信息,单位是分钟。

具体下载目录在 /2014年资料/10月/10日/Nagios监控MongoDB分片集群服务实战

3.2,安装nagios插件

[[email protected] ~]# yum -yinstall gcc gcc-c++ make openssl openssl-devel

notification_options:通知选项跟联系人配置文件相同。

下载方法见 http://www.linuxidc.com/Linux/2013-07/87684.htm

3.3,安装nrpe

tar -xvf nrpe-2.15.tar.gz

cd nrpe-2.15

./configure--with-nrpe-user=nagios --with-nrpe-group=nagios --with-nagios-user=nagios--with-nagios-group=nagios --enable-command-args --enable-ssl

make all

make install-plugin

make install-daemon

make install-daemon-config

 

contact_groups:配置文件contactgroup.cfg定义的组名称。

------------------------------------------分割线------------------------------------------

3.4,去检查nrpe配置

grep -v '^#' /usr/local/nagios/etc/nrpe.cfg |sed '/^$/d'

[[email protected] ~]# grep -v '^#' /usr/local/nagios/etc/nrpe.cfg|sed '/^$/d'

log_facility=daemon

pid_file=/var/run/nrpe.pid

server_port=5666

nrpe_user=nagios

nrpe_group=nagios

allowed_hosts=127.0.0.1,192.168.121.211

dont_blame_nrpe=0

allow_bash_command_substitution=0

debug=0

command_timeout=60

connection_timeout=300

command[check_users]=/usr/local/nagios/libexec/check_users-w 8 -c 12

command[check_load]=/usr/local/nagios/libexec/check_load -w15,10,5 -c 30,25,20

command[check_sda1]=/usr/local/nagios/libexec/check_disk -w20% -c 10% -p /dev/sda3

command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs-w 5 -c 10 -s Z

command[check_total_procs]=/usr/local/nagios/libexec/check_procs-w 750 -c 800

command[check-host-alive]=/usr/local/nagios/libexec/check_ping-H 10.254.3.72 -w 3000.0,80% -c 5000.0,100% -p 5

command[check_mysql_status]=/usr/local/nagios/libexec/check_mysql-unagios -P3306 -s /usr/local/mysql/mysql.sock -Hlocalhost--password='[email protected]' -d test -w 60 -c 100

[[email protected] ~]#

 

注意:check_command选项后面跟的命令一定要在commands.cfg里有定义;

网络监控器Nagios全攻略 http://www.linuxidc.com/Linux/2013-07/87067.htm

3.5,启动nrpe

/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe

 

 

例子:

Nagios搭建与配置详解 http://www.linuxidc.com/Linux/2013-05/84848.htm

4,制作启动脚本:

[[email protected] bin]# cat /etc/init.d/nrped

 

#chkconfig: 2345 80 90

#description:auto_run

 

NRPE=/usr/local/nagios/bin/nrpe

NRPECONF=/usr/local/nagios/etc/nrpe.cfg

 

case "$1" in

start)

echo -n "Starting NRPE daemon..."

$NRPE -c $NRPECONF -d

echo " done."

;;

stop)

echo -n "Stopping NRPE daemon..."

pkill -u nagios nrpe

echo " done."

;;

restart)

$0 stop

sleep 2

$0 start

;;

*)

echo "Usage: $0 start|stop|restart"

;;

esac

exit 0

[[email protected] bin]#

 

 

vi  /usr/local/nagios/etc/services.cfg

Nginx环境下构建Nagios监控平台 http://www.linuxidc.com/Linux/2011-07/38112.htm

5,设置启动

chmod +x /etc/init.d/nrped

chkconfig --add nrped

chkconfig nrped on

 

[[email protected] bin]# ps -eaf|grep nrpe

nagios 30440 1 0 23:48 ? 00:00:00 /usr/local/nagios/bin/nrpe -c/usr/local/nagios/etc/nrpe.cfg -d

root 30442 3292 0 23:48 pts/0 00:00:00 grep nrpe

[[email protected] bin]#

[[email protected] bin]# netstat -tnlp |grepnrpe

tcp 0 0 0.0.0.0:5666 0.0.0.0:* LISTEN 30440/nrpe

tcp 0 0 :::5666 :::* LISTEN 30440/nrpe

[[email protected] bin]#

 

 

#监控主机是否存活

在RHEL5.3上配置基本的Nagios系统(使用Nagios-3.1.2) http://www.linuxidc.com/Linux/2011-07/38129.htm

6,监控端安装nrpe

tar xf nrpe-2.15.tar.gz

cd nrpe-2.15

./configure --with-nrpe-user=nagios --with-nrpe-group=nagios --with-nagios-user=nagios --with-nagios-group=nagios --enable-command-args --enable-ssl

make all

make install-plugin

 

#安装完成后,会在Nagios安装目录的libexec下生成check_nrpe的插件,如下所示:

[[email protected]_db2 nagios]# ll /usr/local/nagios/libexec/check_nrpe

-rwxrwxr-x 1 nagios nagios 76777 Jun 2523:53 /usr/local/nagios/libexec/check_nrpe

[[email protected]_db2 nagios]#

 

检测报错:

[[email protected]_db2 libexec]# ./check_nrpe -H192.168.121.210

CHECK_NRPE: Error - Could not complete SSLhandshake.

[[email protected]_db2 libexec]#

 

去客户端在allowed_hosts中添加监控端IP地址

[[email protected] ~]# vim/usr/local/nagios/etc/nrpe.cfg

allowed_hosts=127.0.0.1,192.168.121.211

 

 

在mysql服务器上,报错:

[[email protected] ~]#/usr/local/nagios/libexec/check_mysql -unagios -P3306 -S -s/usr/local/mysql/mysql.sock -Hlocalhost --password='[email protected]' -d test -w 60-c 100

/usr/local/nagios/libexec/check_mysql:error while loading shared libraries: libmysqlclient.so.18: cannot open sharedobject file: No such file or directory

[[email protected] ~]#

 

[[email protected] ~]# find / -namelibmysqlclient.so.18

/usr/local/mysql/lib/libmysqlclient.so.18

/root/mysql/mysql-5.6.12/libmysql/libmysqlclient.so.18

/root/mysql-5.6.12/libmysql/libmysqlclient.so.18

[[email protected] ~]# ln -s/usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18

[[email protected] ~]#

 

添加mysql账号:

mysql> GRANT PROCESS, SUPER, REPLICATIONCLIENT ON *.* TO 'nagios'@'localhost' IDENTIFIED BY '[email protected]';

Query OK, 0 rows affected (0.05 sec)

 

mysql>

 

客户端自己检测:

[[email protected] ~]#/usr/local/nagios/libexec/check_mysql -unagios -P3306 -s /usr/local/mysql/mysql.sock -Hlocalhost--password='[email protected]' -d test -w 60 -c 100

Uptime: 1823238 Threads: 6 Questions: 684495 Slow queries:0 Opens: 124 Flush tables: 1 Open tables: 116 Queries per second avg:0.375|Connections=3116c;;; Open_files=19;;; Open_tables=116;;; Qcache_free_memory=61538880;;;Qcache_hits=176271c;;; Qcache_inserts=41370c;;; Qcache_lowmem_prunes=0c;;;Qcache_not_cached=331835c;;; Qcache_queries_in_cache=3373;;; Queries=684496c;;;Questions=681384c;;; Table_locks_waited=0c;;; Threads_connected=5;;;Threads_running=2;;; Uptime=1823238c;;;

[[email protected] ~]#

 

define service{

CentOS 5.5+Nginx+Nagios监控端和被控端安装配置指南 http://www.linuxidc.com/Linux/2011-09/44018.htm

7,完善配置文件

        host_name              nagios-server

Ubuntu 13.10 Server 安装 Nagios Core 网络监控运用 http://www.linuxidc.com/Linux/2013-11/93047.htm

7.1在command.cfg里面添加监控command命令

将servers.cfg添加进nagios.cfg里面,将command.cfg里面的check_host_alive以及check_mysql_status补充好,然后重启nagios

# add by timman on 20150512

define command{

command_name check_mysql_status

command_line $USER1$/check_mysql_status-w $ARG1$ -c $ARG2$

}

 

# 'check_nrpe' command definition,add bytimman on 20140508

define command{

command_name check_nrpe

command_line $USER1$/check_nrpe-H $HOSTADDRESS$ -c $ARG1$

}

 

define command{

command_name check_host_alive

command_line $USER1$/check_ping-H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5

}

 

        service_description    check-host-alive

2,添加新的mongodb监控命令

7.2在servers.cfg里面添加check_mysql_status、 check_host_alive等服务监控项。

[[email protected]_db2 etc]# more servers.cfg

# servicedefinition

 

define service{

host_name cactitest

service_description check_load

check_command check_nrpe!check_load

max_check_attempts 5

normal_check_interval 3

retry_check_interval 2

check_period 24x7

notification_interval 10

notification_period 24x7

notification_options w,u,c,r

contact_groups dba

}

 

define service{

host_name cactitest

service_description check_host_alive

check_command check_host_alive

max_check_attempts 5

normal_check_interval 3

retry_check_interval 2

check_period 24x7

notification_interval 10

notification_period 24x7

notification_options w,u,c,r

contact_groups dba

}

 

define service{

host_name cactitest

service_description Check Disksda1

check_command check_nrpe!check_sda1

max_check_attempts 5

normal_check_interval 3

retry_check_interval 2

check_period 24x7

notification_interval 10

notification_period 24x7

notification_options w,u,c,r

contact_groups dba

}

 

define service{

host_name cactitest

service_description TotalProcesses

check_command check_nrpe!check_total_procs

max_check_attempts 5

normal_check_interval 3

retry_check_interval 2

check_period 24x7

notification_interval 10

notification_period 24x7

notification_options w,u,c,r

contact_groups dba

}

 

define service{

host_name cactitest

service_description CurrentUsers

check_command check_nrpe!check_users

max_check_attempts 5

normal_check_interval 3

retry_check_interval 2

check_period 24x7

notification_interval 10

notification_period 24x7

notification_options w,u,c,r

contact_groups dba

}

 

 

define service{

host_name cactitest

service_description CheckZombie Procs

check_command check_nrpe!check_zombie_procs

max_check_attempts 5

normal_check_interval 3

retry_check_interval 2

check_period 24x7

notification_interval 10

notification_period 24x7

notification_options w,u,c,r

contact_groups dba

}

 

 

define service{

host_name cactitest

service_description CheckMysql Status

check_command check_nrpe!check_mysql_status

max_check_attempts 5

normal_check_interval 3

retry_check_interval 2

check_period 24x7

notification_interval 10

notification_period 24x7

notification_options w,u,c,r

contact_groups dba

}

 

 

 

        check_command          check-host-alive

因为mongodb服务是和mysql从库公用一台物理机,之前已经做了基础nagios以及mysql服务监控,所以这里只需要在原来的基础上添加mongodb命令和服务即可。Nagios监控mysql请参考: http://www.linuxidc.com/Linux/2014-10/107809.htm 以及 http://www.linuxidc.com/Linux/2014-07/104241.htm 。所以这里需要添加的mongodb监控命令如下所示:

7.3 在nagios.cfg加载servers.cfg等配置文件

在nagios.cfg里面配置

cfg_file=/usr/local/nagios/etc/servers.cfg

 

同时添加新的主机或者服务配置cfg文件,都需要在nagios.cfg里面配置一下,然后重启nagios才能生效,如下所示:

[[email protected]_db2 nagios]# grep -v '^#'/usr/local/nagios/etc/nagios.cfg |sed '/^$/d' |grep cfg_file

cfg_file=/usr/local/nagios/etc/objects/commands.cfg

cfg_file=/usr/local/nagios/etc/objects/contacts.cfg

cfg_file=/usr/local/nagios/etc/contactgroups.cfg

cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg

cfg_file=/usr/local/nagios/etc/objects/templates.cfg

cfg_file=/usr/local/nagios/etc/hosts.cfg

cfg_file=/usr/local/nagios/etc/servers.cfg

cfg_file=/usr/local/nagios/etc/hostgroups.cfg

cfg_file=/usr/local/nagios/etc/objects/localhost.cfg

[[email protected]_db2 nagios]#

 

 

        max_check_attempts      5

[root@wgq objects]# cd /usr/local/nagios/etc/objects 
[root@wgq objects]# vim commands.cfg 
define command { 
    command_name check_mongodb 
    command_line $USER1$/nagios-plugin-mongodb/check_mongodb.py -H $HOSTADDRESS$ -A $ARG1$ -P $ARG2$ -W $ARG3$ -C $ARG4$ 

 
define command { 
    command_name check_mongodb_database 
    command_line $USER1$/nagios-plugin-mongodb/check_mongodb.py -H $HOSTADDRESS$ -A $ARG1$ -P $ARG2$ -W $ARG3$ -C $ARG4$ -d $ARG5$ 

 
define command { 
    command_name check_mongodb_collection 
    command_line $USER1$/nagios-plugin-mongodb/check_mongodb.py -H $HOSTADDRESS$ -A $ARG1$ -P $ARG2$ -W $ARG3$ -C $ARG4$ -d $ARG5$ -c $ARG6$ 

 
define command { 
    command_name check_mongodb_replicaset 
    command_line $USER1$/nagios-plugin-mongodb/check_mongodb.py -H $HOSTADDRESS$ -A $ARG1$ -P $ARG2$ -W $ARG3$ -C $ARG4$ -r $ARG5$ 

 
define command { 
    command_name check_mongodb_query 
    command_line $USER1$/nagios-plugin-mongodb/check_mongodb.py -H $HOSTADDRESS$ -A $ARG1$ -P $ARG2$ -W $ARG3$ -C $ARG4$ -q $ARG5$ 

8,之后在页面就可以看到监控效果了

 

金沙js333娱乐场 1

 

 

1、NRPE介绍 NRPE是Nagios的一个功能扩展,它可在远程Linux/Unix主机上执行插件程序。通过在远程服务器上安...

        normal_check_interval  5

3,添加mongodb监控服务

        retry_check_interval    2

mongodb的服务也需要单独重新添加,如下所示:

        check_period            24x7

#检测mongodb服务的连接时间,超过2秒就普通报警,5秒就严重报警 
define service{ 
        host_name dbm1slave1 
        service_description Mongo Connect Check 
        check_command check_mongodb!connect!30000!2!5 
        max_check_attempts 5 
        normal_check_interval 3 
        retry_check_interval 2 
        check_period 24x7 
        notification_interval 10 
        notification_period 24x7 
        notification_options w,u,c,r 
        contact_groups ops 
        } 
 
#检查mongodb的连接数,超过150普通报警,200严重报警 
define service{ 
        host_name dbm1slave1 
        service_description Mongo Free Connections 
        check_command check_mongodb!connections!27017!70!80 
        max_check_attempts 5 
        normal_check_interval 3 
        retry_check_interval 2 
        check_period 24x7 
        notification_interval 10 
        notification_period 24x7 
        notification_options w,u,c,r 
        contact_groups ops 
        } 
         
         
#检查mongodb复制完成的百分比率,确保primary和standby的time是一致的。 
define service{ 
        host_name dbm1slave1 
        service_description Mongo Replication Lag 
        check_command check_mongodb!replication_lag!27017!15!30 
        max_check_attempts 5 
        normal_check_interval 3 
        retry_check_interval 2 
        check_period 24x7 
        notification_interval 10 
        notification_period 24x7 
        notification_options w,u,c,r 
        contact_groups ops 
        } 
         
#检查mongodb内存使用率,阀值与mongodb所在机器的总内存数相关 
define service{ 
        host_name dbm1slave1 
        service_description Mongo Memory Usage 
        check_command check_mongodb!memory!27017!20!28 
        max_check_attempts 5 
        normal_check_interval 3 
        retry_check_interval 2 
        check_period 24x7 
        notification_interval 10 
        notification_period 24x7 
        notification_options w,u,c,r 
        contact_groups ops 
        } 
         
#检查mongodb Mapped的内存使用率,阀值与mongodb所在机器的总内存数相关 
define service{ 
        host_name dbm1slave1 
        service_description Mongo Mapped Memory Usage 
        check_command check_mongodb!memory_mapped!27017!20!28 
        max_check_attempts 5 
        normal_check_interval 3 
        retry_check_interval 2 
        check_period 24x7 
        notification_interval 10 
        notification_period 24x7 
        notification_options w,u,c,r 
        contact_groups ops 
        } 
         
#检查Lock Time的百分率,如果lock time占据mongo运行时间的5%就普通报警,如果超过10%就严重报警 
define service{ 
        host_name dbm1slave1 
        service_description Mongo Lock Percentage 
        check_command check_mongodb!lock!27017!5!10 
        max_check_attempts 5 
        normal_check_interval 3 
        retry_check_interval 2 
        check_period 24x7 
        notification_interval 10 
        notification_period 24x7 
        notification_options w,u,c,r 
        contact_groups ops 
        } 
 
# Check Average Flush Time,检查mongo服务器的平均flush时间, 
define service{ 
        host_name dbm1slave1 
        service_description Mongo Flush Average 
        check_command check_mongodb!flushing!27017!100!200 
        max_check_attempts 5 
        normal_check_interval 3 
        retry_check_interval 2 
        check_period 24x7 
        notification_interval 10 
        notification_period 24x7 
        notification_options w,u,c,r 
        contact_groups ops 
        } 
 
# Check Last Flush Time,检查最新的flush时间,如果超过200ms就普通报警,超过400ms就严重报警 
define service{ 
        host_name dbm1slave1 
        service_description Mongo Last Flush Time 
        check_command check_mongodb!last_flush_time!27017!200!400 
        max_check_attempts 5 
        normal_check_interval 3 
        retry_check_interval 2 
        check_period 24x7 
        notification_interval 10 
        notification_period 24x7 
        notification_options w,u,c,r 
        contact_groups ops 
        } 
         
# Check status of mongodb replicaset,检查mongo复制的状态 
define service{ 
        host_name dbm1slave1 
        service_description MongoDB state 
        check_command check_mongodb!replset_state!27017!0!0 
        max_check_attempts 5 
        normal_check_interval 3 
        retry_check_interval 2 
        check_period 24x7 
        notification_interval 10 
        notification_period 24x7 
        notification_options w,u,c,r 
        contact_groups ops 
        } 
 
# Check status of index miss ratio,检查索引命中率, 
define service{ 
        host_name dbm1slave1 
        service_description MongoDB Index Miss Ratio 
        check_command check_mongodb!index_miss_ratio!27017!.005!.01 
        max_check_attempts 5 
        normal_check_interval 3 
        retry_check_interval 2 
        check_period 24x7 
        notification_interval 10 
        notification_period 24x7 
        notification_options w,u,c,r 
        contact_groups ops 
        } 
         
# Check number of databases and number of collections 
define service{ 
        host_name dbm1slave1 
        service_description MongoDB Number of databases 
        check_command check_mongodb!databases!27017!300!500 
        max_check_attempts 5 
        normal_check_interval 3 
        retry_check_interval 2 
        check_period 24x7 
        notification_interval 10 
        notification_period 24x7 
        notification_options w,u,c,r 
        contact_groups ops 
        } 
define service{ 
        host_name dbm1slave1 
        service_description MongoDB Number of collections 
        check_command check_mongodb!collections!27017!300!500 
        max_check_attempts 5 
        normal_check_interval 3 
        retry_check_interval 2 
        check_period 24x7 
        notification_interval 10 
        notification_period 24x7 
        notification_options w,u,c,r 
        contact_groups ops 
        }         
         
# Check size of a database,检查库的大小 
define service{ 
        host_name dbm1slave1 
        service_description MongoDB Database size your-database 
        check_command check_mongodb_database!database_size!27017!300!500!your-database 
        max_check_attempts 5 
        normal_check_interval 3 
        retry_check_interval 2 
        check_period 24x7 
        notification_interval 10 
        notification_period 24x7 
        notification_options w,u,c,r 
        contact_groups ops 
        }                 
         
# Check index size of a database,检查库索引的大小 
define service{ 
        host_name dbm1slave1 
        service_description MongoDB Database index size your-database 
        check_command check_mongodb_database!database_indexes!27017!50!100!your-database 
        max_check_attempts 5 
        normal_check_interval 3 
        retry_check_interval 2 
        check_period 24x7 
        notification_interval 10 
        notification_period 24x7 
        notification_options w,u,c,r 
        contact_groups ops 
        }             
         
# Check index size of a collection,检查集合collection的索引大小 
define service{ 
        host_name dbm1slave1 
        service_description MongoDB Database index size your-database 
        check_command check_mongodb_collection!collection_indexes!27017!50!100!your-database!your-collection 
        max_check_attempts 5 
金沙js333娱乐场,        normal_check_interval 3 
        retry_check_interval 2 
        check_period 24x7 
        notification_interval 10 
        notification_period 24x7 
        notification_options w,u,c,r 
        contact_groups ops 
        } 
         
# Check the primary server of replicaset,检查复制的primary服务 
define service{ 
        host_name dbm1slave1 
        service_description MongoDB Replicaset Master Monitor: your-replicaset 
        check_command check_mongodb_replicaset!replica_primary!27017!0!1!your-replicaset 
        #示例:check_command check_mongodb_replicaset!replica_primary!27017!0!1!shard2 
        max_check_attempts 5 
        normal_check_interval 3 
        retry_check_interval 2 
        check_period 24x7 
        notification_interval 10 
        notification_period 24x7 
        notification_options w,u,c,r 
        contact_groups ops 
        } 
 
         
# Check the number of queries per second,检查每一秒的查询数量 
define service{ 
        host_name dbm1slave1 
        service_description MongoDB Updates per Second 
        check_command check_mongodb_query!queries_per_second!27017!200!150!update 
        max_check_attempts 5 
        normal_check_interval 3 
        retry_check_interval 2 
        check_period 24x7 
        notification_interval 10 
        notification_period 24x7 
        notification_options w,u,c,r 
        contact_groups ops 
        } 
         
# Check Primary Connection,检查复制中与primary库的连接时间,超过2秒就普通报警,超过4秒就严重报警 
define service{ 
        host_name dbm1slave1 
        service_description Mongo Connect Check 
        check_command check_mongodb!connect_primary!27017!2!4 
        max_check_attempts 5 
        normal_check_interval 3 
        retry_check_interval 2 
        check_period 24x7 
        notification_interval 10 
        notification_period 24x7 
        notification_options w,u,c,r 
        contact_groups ops 
        } 
 
# Check Collection State,检查collection状态,检查mongo服务组列表的每一个主机,可以检查重要collection的高可用性(锁、超时、服务配置的可用性),如果发现一个查询失败就会报警。 
define service{ 
        host_name dbm1slave1 
        service_description Mongo Collection State 
        check_command check_mongodb!collection_state!27017!your-database!your-collection 
        max_check_attempts 5 
        normal_check_interval 3 
        retry_check_interval 2 
        check_period 24x7 
        notification_interval 10 
        notification_period 24x7 
        notification_options w,u,c,r 
        contact_groups ops 
        } 

        notification_interval  10

更多详情见请继续阅读下一页的精彩内容: http://www.linuxidc.com/Linux/2014-10/107826p2.htm

        notification_period    24x7

金沙js333娱乐场 2

        notification_options    w,u,c,r

        contact_groups          sagroup

        }

#监控主机的web服务

define service{

        host_name              nagios-server

        service_description    check_tcp 80

        check_period            24x7

        max_check_attempts      4

        normal_check_interval  3

        retry_check_interval    2

        contact_groups          sagroup

        notification_interval  10

        notification_period    24x7

        notification_options    w,u,c,r

        check_command          check_tcp!80

        }

#监控主机的cpu负载情况

define service{

        host_name              nagios-server

        service_description    cpu load

        check_command          check_nrpe!check_load

        check_period            24x7

        max_check_attempts      4

        normal_check_interval  3

        retry_check_interval    2

        contact_groups          sagroup

        notification_interval  10

        notification_period    24x7

        notification_options    w,u,c,r

        }

#监控主机的进程数

define service{

        host_name              nagios-server

        service_description    total-procs

        check_command          check_nrpe!check_total_procs

        check_period            24x7

        max_check_attempts      4

        normal_check_interval  3

        retry_check_interval    2

        contact_groups          sagroup

        notification_interval  10

        notification_period    24x7

        notification_options    w,u,c,r

        }

网络监控器Nagios全攻略 http://www.linuxidc.com/Linux/2013-07/87067.htm

Nagios搭建与配置详解 http://www.linuxidc.com/Linux/2013-05/84848.htm

Nginx环境下构建Nagios监控平台 http://www.linuxidc.com/Linux/2011-07/38112.htm

在RHEL5.3上配置基本的Nagios系统(使用Nagios-3.1.2) http://www.linuxidc.com/Linux/2011-07/38129.htm

CentOS 5.5+Nginx+Nagios监控端和被控端安装配置指南 http://www.linuxidc.com/Linux/2011-09/44018.htm

Ubuntu 13.10 Server 安装 Nagios Core 网络监控运用 http://www.linuxidc.com/Linux/2013-11/93047.htm

Nagios 的详细介绍:请点这里
Nagios 的下载地址:请点这里

本文永久更新链接地址:http://www.linuxidc.com/Linux/2014-09/106584.htm

金沙js333娱乐场 3

本文由js333发布于计算机互联网,转载请注明出处:金沙js333娱乐场:Nagios监控mysql服务器详细实现过

关键词:

上一篇:没有了

下一篇:没有了