nagios具有非常强大的报警功能。还可以结合pnp实现时时绘制图形。可以根据自己的需求定义:nagios的脚控类型,可以说监控服务,nagios已经做到了无所不能:下面给出nagios的安装脚步。后期会慢慢更新如何编写脚步定义企业nagios监控系统:脚步的安装包是已经放到/usr/local/src目录下:
安装脚本。(LAMP环境已经安装好。)nagios最强大的就是开源功能,可以实现用编写nrpe脚本采集数据的方式进行监控报警,可以自己根据自己需求创建出一套自己的监控系统。
yum -y install httpd gcc gcc-c++ glibcglibc-common gd gd-devel
useradd nagios
groupadd nagcmd
usermod -G nagcmd nagios
usermod -G nagcmd apache
cd /usr/local/src
tar zxvf nagios-3.0.6.tar.gz
cd nagios-3.0.6
./configure --with-command-group=nagcmd--prefix=/usr/local/nagios
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
cd ../
tar zxvf nagios-plugins-1.4.13.tar.gz
cd nagios-plugins-1.4.13
./configure --prefix=/usr/local/nagios--with-nagios-user=nagios --with-nagios-group=nagios
make && make install
cd ../
tar zxvf nrpe-2.13.tar.gz
cd nrpe-2.13
./configure
make all
make install-plugin
make install-daemon
make install-daemon-config
htpasswd -bc/usr/local/nagios/etc/htpasswd.users nagiosadmin
123456
echo "aliasnagioscheck=‘/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg‘" >> /root/.bashrc
source /root/.bashrc
chkconfig nagios on
chkconfig httpd on
service httpd start
service nagios start
#基本安装过程这里就不重复了,htpasswd -bc这行代码的作用是不需要人为干预的生成密码名为123456的angiosadmin用户,而后期由于经常要修改/usr/local/nagios/etc/nagios.cfg配置文件,所以需要检测其语法,所以将其长命令生成名为nagioscheck的别名命令。
Nagios客户端自动安装脚本,如下所示:
useradd nagios
cd /usr/local/src
tar zxvf nagios-plugins-1.4.13.tar.gz
cd nagios-plugins-1.4.13
./configure
make
make install
chown nagios:nagios /usr/local/nagios
chown -R nagios:nagios/usr/local/nagios/libexec
cd ../
tar zxvf nrpe-2.13.tar.gz
cd nrpe-2.13
./configure
make all
make install-plugin
make install-daemon
make install-daemon-config
/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
nagios:服务器端中文插件安装:
5、安装Nagios中文化插件
中文插件下载地址:
http://sourceforge.net/projects/nagios-cn/files/
下载对应nagios版本的中文插件,然后开始安装:
[root@localhost ~]#tar xvfznagios-cn-3.2.0.tar.bz2
[root@localhost nagios-cn-3.2.0]#cdnagios-cn-3.2.0
[root@localhost nagios-cn-3.2.0]#./configure
[root@localhost nagios-cn-3.2.0]#make all
[root@localhost nagios-cn-3.2.0]#make install
注:安装中文插件的适合很容易出乱码。一般通过添加apache的utf8支持可以完成
<Directory />
AddDefaultCharset UTF-8 #加入格式支持
</Directory>
开启cgi模块:
LoadModule cgid_module modules/mod_cgid.so
LoadModule actions_modulemodules/mod_actions.so
重起apache
本文出自 “小罗” 博客,请务必保留此出处http://xiaoluoge.blog.51cto.com/9141967/1587079
原文地址:http://xiaoluoge.blog.51cto.com/9141967/1587079