MySQL伺服器部署nagios監控

mchdba發表於2013-05-08


-- ulimit -n 65535
-- 監控nagios客戶端強行安裝
1,安裝
[root@localhost nagios]# ll
總計 768
-rw-r--r-- 1 root root 713389 12-16 12:08 nagios-plugins-1.4.11-1.x86_64.rpm
-rw-r--r-- 1 root root  32706 12-16 12:09 nrpe-2.12-1.x86_64.rpm
-rw-r--r-- 1 root root  18997 12-16 12:08 nrpe-plugin-2.12-1.x86_64.rpm

Shell> rpm -ivh *.rpm --nodeps  --force

 

2,檢測
[root@rdb-s108 nagios]# /usr/lib64/nagios/plugins/check_mysql -unagios -P3306 -S -Hlocalhost -ppwdnagios -s/opt/mysql/product/mysql/mysql3306.sock -d test -w 60 -c 100

 

3,加進配置檔案裡面去
[root@rdb-s108 nagios]# vim /etc/nagios/nrpe.cfg

command[check_mysqlapi]=/usr/lib64/nagios/plugins/check_mysql -unagios -P3306 -S -Hlocalhost -ppwdnagios -s/opt/mysql/product/mysql/mysql3306.sock -d test -w 60 -c 100
加監控主機伺服器ip地址
allowed_hosts = 127.0.0.1,192.168.188.110,10.80.98.2

-- 賦予許可權
chmod 775 /usr/lib/nagios/plugins/check_mysql
-- 磁碟監控,檢視
fdisk -l
Disk /dev/sda: 193.2 GB, 193273528320 bytes
255 heads, 63 sectors/track, 23497 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14       23497   188635230   8e  Linux LVM

取 Disk 後面的 /dev/sda 作為磁碟監控

 

4,重啟nagios,失敗

5,先刪除再啟動
[root@rdb-s108 bin]# killall nrpe 【】先刪除
[root@rdb-s108 local]#  /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d
[root@rdb-s108 local]#

 

6,vim "/etc/nagios/nrpe.cfg" 看情況
註釋:# command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1
開啟:#command[check_disk]=/usr/lib/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$

grant SUPER,REPLICATION CLIENT on *.* to identified by 'pwdnagios';

7,檢測狀況 service nrpe status


8,檢查
shell> vim /etc/nagios/nrpe.cfg
command[check_disk]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda
shell> fdisk -l
shell> service nrpe restart

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26230597/viewspace-760141/,如需轉載,請註明出處,否則將追究法律責任。

相關文章