什么是NAGIOS Nagios是一个监视系统运行状态和网络信息的监视系统,它能监视所指定的本地或远程主机以及服务,同时提供异常通知功能等。
特点
能够监控windows、linux、unix、交换机等多种硬件设备,同时提供一个WEB界面以方便系统管理员查看设备、服务状况,并能在系统或服务异常时发出邮件或者短信报警第一时间通知运维人员。强大而又简单的插件设计能够方便实现用户各种个性化的监测需要。 Nagios的功能是监控服务和主机,但是他自身并不包括这部分功能,所有的监控、检测功能都是通过各种插件来完成的。 Nagios通过NRPE管理远端服务。 Nagios本身已经实现了基本的监控需求,但是要想更好的收集数据、展示数据,我们还可能用到以下技术: 数据沉淀,将监控数据以及nagios的配置信息导入到数据库中:
Mysql、ndoutil 前台监控信息展示:
apache、rrdtool、centreon等
centreon作为nagios的分布式监控管理平台 centreon 在功能方面,将它与nagios+cacti方式对比: 1、gui方式添加host,支持hosttemplate与servicestemplate,自动建立关联服务 2、支持graphtemplate,添加servcie时自动添加graph 3、host监控方式多样 4、支持多节点分布式监控 5、支持acl权限管理方式,对用户权限限制到菜单项 6、详细的日志管理功能,日志搜索过滤都支持 7、功能模块化管理 相关知识点请大家可以百度下;这里不多叙述; 1、Nagios Server端安装;
主机信息: CentOSLinux release 6.0 (Final) Linux master.monitor.com2.6.32-71.el6.i686 #1 SMP Fri Nov 12 04:17:17 GMT 2010 i686 i686 i386GNU/Linux hostname:master.monitor.com ifconfigeth0:192.168.100.187 正常联网~~ 1、安装lamp平台; 测试链接正常即可! 启动相关服务
安装GD库: 1
| yum installgdfontconfig-devellibjpeg-devellibpng-develgd-develperl-GD-y
|
安装mysql模块:
1
| yum installopenssl-develperl-DBD-MySQLmysql-servermysql-devel -y
|
安装PHP及扩展:
1
| yum installphpphp-mysqlphp-gdphp-ldapphp-xml php-mbstring
|
安装PERL及扩展模块: 1
| yum installperl-Config-IniFilesperl-DBI perl-DBD-MySQL-y
|
安装RRDTools:
1
| yum installrrdtoolperl-rrdtool -y
|
安装SNMP:
1
2
3
| yum installperl-Crypt-DESperl-Digest-SHA1 perl-Digest-HMACnet-snmp-utils -y
yum installperl-Socket6 perl-IO-Socket-INET6 net-snmp net-snmp-libs–y
yum installphp-snmpdmidecodelm_sensorsperl-Net-SNMPnet-snmp-perl -y
|
安装其他所需库: 1
| yum installfpingcppgccgcc-c++ libstdc++glib2-devel –y
|
安装PEAR: 1
2
3
| yum installphp-pear
pear channel-updatepear.php.net
pear upgrade-all
|
安装nagios
(相关包已经上传至服务器) 1
2
3
4
5
6
7
8
9
10
11
12
| useradd nagios
groupadd nagcmd
Usermod –G nagios,nagcmdnagios
tar zxvf nagios-3.4.1.tar.gz
cd nagios
./configure--prefix=/usr/local/nagios--with-command-group=nagcmd--enable-nanosleep--enable-event-broker --enable-embedded-perl
make all
make install
make install-init
make install-commandmode
make install-config
make install-webconf
|
安装nagios-plugins
1
2
3
4
| tar zxvf nagios-plugins-1.4.16.tar.gz
cd nagios-plugins-1.4.16
./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl=/usr/bin/openssl --enable-perl-modules
make && make install
|
安装nrpe
1
2
3
4
5
6
7
| tar zxvf nrpe-2.12.tar.gz
cd nrpe-2.12
./configure
make all
make install-plugin
make install-daemon
make install-daemon-config
|
安装ndoutils
1
2
3
4
5
6
7
8
9
10
11
12
13
| tar -xvf ndoutils-1.4b9.tar.gz
cd ndoutils-1.4b9
patch -p1 -N <../ndoutils1.4b9_light.patch
./configure --prefix=/usr/local/nagios/ --enable-mysql --disable-pgsql --with-ndo2db-user=nagios --with-ndo2db-group=nagios
make
make install
chmod 774 /usr/local/nagios/bin/*
chown nagios:nagios /usr/local/nagios/bin/*
chown nagios:nagios /usr/local/nagios/etc/*
cp daemon-init /etc/init.d/ndo2db
chmod +x /etc/init.d/ndo2db
chkconfig --add ndo2db
chkconfig --level 345 ndo2db on
|
安装centreon 1
2
3
| tar zxvf centreon-2.3.8.tar.gz
cd centreon-2.3.8
./install.sh -i (按照提示一步步进行安装、以下过程全部截图~)
|
1
2
| GPL许可证,填写y
确定安装centreon几部分模块,全部填写y
|
Centreonetcdirectory更改为/usr/local/centreon/etc Centreonvariable library directory更改为/usr/local/centreon/var/lib PS: 以上两个文件,最好另外终端去find下,有时候系统位置不一样的,比如,图上是我find的路径 NDO ndomodbinary更改为/usr/local/nagios/bin/ndomod.o 开始在线更新pear模块 CentPluginslib directory更改为/usr/local/centreon/var/lib/centplugins
启动相关服务 1
2
3
4
| [iyunv@centreon ~]#/etc/init.d/httpd start
[iyunv@centreon ~]#/etc/init.d/mysqld start
[iyunv@centreon ~]# mysqladmin -uroot password '111111'
[iyunv@centreon ~]#/etc/init.d/ndo2db start
|
关于centreon的web安装,见下篇,写不下了~
|