大橙子网站建设,新征程启航

为企业提供网站建设、域名注册、服务器等服务

Nagios客户端简单安装

安装nagios 客户端

为曲沃等地区用户提供了全套网页设计制作服务,及曲沃网站建设行业解决方案。主营业务为成都网站建设、网站制作、曲沃网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!

客户端仅仅需要安装下面内容

Class-Accessor-0.31.tar.gz

Config-Tiny-2.12.tar.gz

Math-Calc-Units-1.07.tar.gz

Nagios-Plugin-0.34.tar.gz

Params-Validate-0.91.tar.gz

Regexp-Common-2010010201.tar.gz

check_iostat

check_memory.pl

nrpe-2.12.tar.gz

第一步:修改YUM源码

cd /etc/yum.repos.d/

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

第二步:调整字符集

echo 'export LC_ALL=C'>> /etc/profile

source /etc/profile

echo $LC_ALL

第三部:关闭防火墙

/etc/init.d/iptables stop

/etc/init.d/iptables stop

chkconfig iptables off

setenforce 0         #临时生效

sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config  #永久生效

setenforce 0    

sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config  

第四部:时间同步

/usr/sbin/ntpdate pool.ntp.org

echo '#time sync'>>/var/spool/cron/root

echo '*/10 * * * * /usr/sbin/ntpdate pool.ntp.org >/dev/null 2>&1'>>/var/spool/cron/root

crontab -l

第五步:创建nagios用户

/usr/sbin/useradd -m nagios -s /sbin/nologin

第六步:安装nagios客户端插件

[ ! -d /home/lvnian/tools  ] &&  mkdir /home/lvnian/tools -p

cd /home/lvnian/tools

yum -y install perl-devel openssl-devel

tar zxf nagios-plugins-1.4.16.tar.gz

cd nagios-plugins-1.4.16

./configure --prefix=/usr/local/nagios --enable-perl-modules --enable-redhat-pthread-workaround 

make && make install

cd ../

ls /usr/local/nagios/libexec/|wc -l

cd /home/lvnian/tools/

tar zxf nrpe-2.12.tar.gz

cd nrpe-2.12

./configure

make all

make install-plugin

make install-daemon

make install-daemon-config

cd ..

#---------------------------------------- 

cd /home/lvnian/tools/

tar zxvf Params-Validate-0.91.tar.gz 

cd Params-Validate-0.91 

perl Makefile.PL 

make  

make install 

cd .. 

#---------------------------------------- 

cd /home/lvnian/tools/

tar zxvf Class-Accessor-0.31.tar.gz

cd Class-Accessor-0.31

perl Makefile.PL

make

make install

cd ..

#---------------------------------------- 

cd /home/lvnian/tools/

tar zxvf Config-Tiny-2.12.tar.gz

cd Config-Tiny-2.12

perl Makefile.PL

make

make install

cd ..

#---------------------------------------- 

cd /home/lvnian/tools/

tar zxvf Math-Calc-Units-1.07.tar.gz

cd Math-Calc-Units-1.07

perl Makefile.PL

make

make install

cd ..

#---------------------------------------- 

cd /home/lvnian/tools/

tar zxvf Regexp-Common-2010010201.tar.gz

cd Regexp-Common-2010010201

perl Makefile.PL

make

make install

cd ..

#---------------------------------------- 

cd /home/lvnian/tools/

tar zxvf Nagios-Plugin-0.34.tar.gz

cd Nagios-Plugin-0.34

perl Makefile.PL

make

make install

cd ..

#______________________ 

#for monitor iostat 

yum install sysstat -y

yum install dos2unix -y 

/bin/cp /home/lvnian/tools/check_memory.pl /usr/local/nagios/libexec

/bin/cp /home/lvnian/tools/check_iostat /usr/local/nagios/libexec

chmod 755 /usr/local/nagios/libexec/check_memory.pl

chmod 755 /usr/local/nagios/libexec/check_iostat

dos2unix /usr/local/nagios/libexec/check_memory.pl

dos2unix /usr/local/nagios/libexec/check_iostat

##################################################

配置nrpe 配置文件

perl -pi -e 's/allowed_hosts=127.0.0.1/allowed_hosts=127.0.0.1,10.0.0.3/g' /usr/local/nagios/etc/nrpe.cfg 

或者 sed -i 's/allowed_hosts=127.0.0.1/allowed_hosts=127.0.0.1,10.0.0.3/g' /usr/local/nagios/etc/nrpe.cfg 

这一步的目的是,让nagios服务端能够到这来获取设计

#delete 199--203

cp /usr/local/nagios/etc/nrpe.cfg /usr/local/nagios/etc/nrpe.cfg.ori

sed -i '199,203d' /usr/local/nagios/etc/nrpe.cfg

echo "command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,6 -c 30,25,20">>/usr/local/nagios/etc/nrpe.cfg

echo "command[check_mem]=/usr/local/nagios/libexec/check_memory.pl -w 6% -c 3%">>/usr/local/nagios/etc/nrpe.cfg

echo "command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 8% -p /">>/usr/local/nagios/etc/nrpe.cfg

echo "command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10%">>/usr/local/nagios/etc/nrpe.cfg

echo "command[check_iostat]=/usr/local/nagios/libexec/check_iostat -w 6 -c 10">>/usr/local/nagios/etc/nrpe.cfg

启动nagios 客户端 nrpe

pkill nrpe 

sleep 2

/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d

echo  "#nagios nrpe process cmd by lvnian 2012-6-7" >> /etc/rc.local

echo "/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d">>/etc/rc.local

netstat -lnt|grep 5666 

重启nagios  nrpe的命令:

pkill nrpe && /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d ||/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d 

netstat -lnt | grep 5666

检查插件数量

[root@Nagios etc]# ls /usr/local/nagios/libexec/|wc -l

64

[root@centos tools]# ls /usr/local/nagios/libexec/|wc -l

62


网站题目:Nagios客户端简单安装
URL网址:http://dzwzjz.com/article/jcgsdi.html
在线咨询
服务热线
服务热线:028-86922220
TOP