[root@king02 ~]# useradd nagios [root@king02 ~]# tar zxvf nagios-plugins-2.2.1.tar.gz [root@king02 ~]# cd nagios-plugins-2.2.1 [root@king02 nagios-plugins-2.2.1]# ./configure --prefix=/usr/local/nagios \ --with-cgiurl=/nagios/cgi-bin \ --with-nagios-user=nagios \ --with-nagios-group=nagios [root@king02 nagios-plugins-2.2.1]# make [root@king02 nagios-plugins-2.2.1]# make install [root@king02 ~]# yum install -y xinetd [root@king02 ~]# tar zxvf nrpe-3.2.1.tar.gz [root@king02 ~]# cd nrpe-3.2.1 [root@king02 nrpe-3.2.1]# ./configure --prefix=/usr/local/nagios --enable-ssl [root@king02 nrpe-3.2.1]# make all [root@king02 nrpe-3.2.1]# make install [root@king02 nrpe-3.2.1]# make install-plugin [root@king02 nrpe-3.2.1]# make install-daemon [root@king02 nrpe-3.2.1]# make install-config [root@king02 nrpe-3.2.1]# make install-inetd [root@king02 ~]# vi /etc/xinetd.d/nrpe # default: off # description: NRPE (Nagios Remote Plugin Executor) service nrpe { disable = no socket_type = stream port = 5666 wait = no user = nagios group = nagios server = /usr/local/nagios/bin/nrpe server_args = -c /usr/local/nagios/etc/nrpe.cfg --inetd only_from = 192.168.1.201 log_on_success = } [root@king02 ~]# vi /etc/services nrpe 5666/tcp # nagios [root@king02 ~]# yum -y install perl-Time-HiRes [root@king02 ~]# rpm -ivh perl-UNIVERSAL-require-0.13-1.el6.rf.noarch.rpm [root@king02 ~]# tar zxvf Sys-Statistics-Linux-0.66.tar.gz [root@king02 ~]# cd Sys-Statistics-Linux-0.66 [root@king02 Sys-Statistics-Linux-0.66]# perl Makefile.PL [root@king02 Sys-Statistics-Linux-0.66]# make [root@king02 Sys-Statistics-Linux-0.66]# make install [root@king02 ~]# vi /usr/local/nagios/etc/nrpe.cfg allowed_hosts=192.168.1.201 command[check_cpu]=/usr/local/nagios/libexec/check_linux_stats.pl -C -w 50 -c 80 -s 5 command[check_memory]=/usr/local/nagios/libexec/check_memory.py -w 20 -c 10 command[check_disk]=/usr/local/nagios/libexec/check_disk.pl -w 20 -c 10 command[check_network]=/usr/local/nagios/libexec/check_linux_stats.pl -N -w 1048576 -c 2097152 -p eth0 command[check_uptime]=/usr/local/nagios/libexec/check_linux_stats.pl -U -w 5 [root@king02 ~]# cd /usr/local/nagios/libexec [root@king02 libexec]# chmod a+x check_linux_stats.pl [root@king02 libexec]# chmod a+x check_memory.py [root@king02 libexec]# chmod a+x check_disk.pl [root@king02 libexec]# ./check_linux_stats.pl -C -w 50 -c 80 -s 5 CPU OK : idle 97.79% |idle=97.79%;50;80 user=0.00% system=0.00% iowait=2.21% steal=0.00% [root@king02 ~]# /etc/init.d/xinetd start Starting xinetd: [ OK ] [root@king02 ~]# netstat -tunlp | grep 5666 tcp 0 0 :::5666 :::* LISTEN 2409/xinetd
开源监控解决方案:ICINGA(Nagios)监控Linux
猜你喜欢
转载自blog.51cto.com/13598811/2155153
今日推荐
周排行