中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Nagios 客戶端簡單安裝

發布時間:2020-07-21 11:35:47 來源:網絡 閱讀:758 作者:lvnian2009 欄目:移動開發

安裝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


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

满洲里市| 徐水县| 吉安县| 高青县| 肇庆市| 湾仔区| 志丹县| 乐山市| 安陆市| 阿拉善左旗| 延津县| 镇坪县| 临城县| 招远市| 江永县| 镇远县| 定州市| 浑源县| 克什克腾旗| 兴国县| 遵义市| 仁布县| 阿勒泰市| 西青区| 馆陶县| 金秀| 凤庆县| 巴中市| 济源市| 葫芦岛市| 时尚| 靖远县| 宾阳县| 陇西县| 周口市| 东乡| 夏津县| 福海县| 石渠县| 莫力| 尚志市|