网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

nagios监控的安装

一.服务端的安装

创新互联建站是一家专注于成都网站设计、成都网站制作和香港机房服务器托管的网络公司,有着丰富的建站经验和案例。

所需的安装包:http://pan.baidu.com/s/1dFKaM8D

环境:centos7  IP:192.168.217.131

(1)  step 1:install gcc and lamp env etc

yum install gccglibc glibc-common -y

yum install gdgd-devel -y

yum installhttpd php php-gd -y

yum installMySQL* -y

 

(2) step 2:add nagios  user and group

/usr/sbin/useradd-m nagios

#/usr/sbin/useraddapache

/usr/sbin/groupaddnagcmd

/usr/sbin/usermod-a -G nagcmd nagios

/usr/sbin/usermod-a -G nagcmd apache

 

(3)  step 3:download and install nagios

unzipoldboy_training_nagios_soft.zip

tar xzfnagios-3.5.1.tar.gz

cd nagios

./configure 【--with-group=nagios --with-user=nagios

】--with-command-group=nagcmd

make all

make install

makeinstall-init

makeinstall-config

makeinstall-commandmode

makeinstall-webconf          #出现404,说明没执行这个

(4)  step 4:config web auth

htpasswd -cb/usr/local/nagios/etc/htpasswd.users tong 123456 //用户认证,登录nagios

 

(5) step 5:install nagios-plugins

yum -y installperl-devel

tar zxfnagios-plugins-2.1.1.tar.gz

cdnagios-plugins-2.1.1

./configure--with-nagios-user=nagios --with-nagios-group=nagios --

enable-perl-modules

make &&make install

ls /usr/local/nagios/libexec/|wc-l     看有几个

 

(6)  step 6:install nrpe

tar zxvfnrpe-2.12.tar.gz

cd nrpe-2.12

./configure

make all

makeinstall-plugin

makeinstall-daemon

makeinstall-daemon-config

 

(7)  step 7:startup service and check

/etc/init.d/nagios start

service httpd start

echo -----------

lsof -i tcp:80

echo ----------

ps -ef|grepnagios   没进程就iptables -F

echo"NAGIOS is successfully installed."

echo ok

我的访问地址:http://192.168.217.131/nagios/

二.客户端的安装

环境:centos7   IP:192.168.217.137

(1)  step 1: add nagios user

#useradd -mnagios -s /sbin/nologin

 

(2)  step 2: install nagios-plugins  

yum -y install perl-devel

tar zxfnagios-plugins-2.1.1.tar.gz

cdnagios-plugins-2.1.1

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

make &&make install

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

 

(3)  step 3: install nrpe     

tar zxfnrpe-2.12.tar.gz

cd nrpe-2.12

./configure

make all

makeinstall-plugin

makeinstall-daemon

makeinstall-daemon-config

 

(4)  step 4: install soft for iostat   

tar zxvfParams-Validate-0.91.tar.gz

cdParams-Validate-0.91

perl Makefile.PL

make 

make install

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

tar zxvfClass-Accessor-0.31.tar.gz

cdClass-Accessor-0.31

perl Makefile.PL

make

make install

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

tar zxvfConfig-Tiny-2.12.tar.gz

cd Config-Tiny-2.12

perl Makefile.PL

make

make install

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

tar zxvfMath-Calc-Units-1.07.tar.gz

cdMath-Calc-Units-1.07

perl Makefile.PL

make

make install

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

tar zxvfRegexp-Common-2010010201.tar.gz

cdRegexp-Common-2010010201

perl Makefile.PL

make

make install

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

tar zxvfNagios-Plugin-0.34.tar.gz

cdNagios-Plugin-0.34

perl Makefile.PL

make

make install

#______________________

#for monitoriostat

yum installsysstat -y

【check_memory.pl安装包有】

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

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

 

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

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

 

yum install -ydos2unix

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

dos2unix/usr/local/nagios/libexec/check_iostat

ls/usr/local/nagios/libexec/|wc -l   插件数量

 

(5)  step 5: 修改nrpe.cfg

cd/usr/local/nagios/etc/  #配置文件路径

#cp nrpe.cfgnrpe.cfg.bk   备份

#vim nrpe.cfg+79

perl -pi -e 's/allowed_hosts=127.0.0.1/

【allowed_hosts=127.0.0.1,192.168.217.131(服务端)】/g'

#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

-c30,25,20">>/usr/local/nagios/etc/nrpe.cfg

 

echo"command[check_mem]=/usr/local/nagios/libexec/check_memory.pl -w 6%

-c3%">>/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

-c10">>/usr/local/nagios/etc/nrpe.cfg

(6)  step 6: start nagios client

#start nagiosclient

pkill nrpe

sleep 2

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

 

#echo"/usr/local/nagios/bin/nrpe -c- /usr/local/nagios/etc/nrpe.cfg -

d">>/etc/rc.local         开机自动启动

 

#netstat-lnt|grep 5666 && echo "nagios client is ok"

nagios监控的安装

三.登录验证:

nagios监控的安装

nagios监控的安装

由于没有启动客户端的机器,所以只能看到服务器的机器up


当前题目:nagios监控的安装
URL地址:http://bjjierui.cn/article/piopsc.html

其他资讯