一、FAN是一个基于centos的迷你版系统,可以直接下载iso镜像安装。它也可以安装在redhat平台上,FAN 2.1一般都是安装在redhat 5.x平台的32位系统上。
官网:http://www.fullyautomatednagios.org/download/
二、配置网络和dns
1.network
[root@oracle64 Desktop]# cat /etc/sysconfig/network-scripts/ifcfg-eth3
2.dns
[root@oracle64 Desktop]# cat /etc/resolv.conf
search localdomain
nameserver 210.21.4.130
nameserver 221.5.88.88
二、安装在32位的系统上很简单
1.安装 epel-release
[root@oracle64 Desktop]# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
2.安装 Graphviz repo :
[root@oracle64 Desktop]# cd /etc/yum.repos.d/
[root@oracle64 Desktop]# wget http://www.graphviz.org/graphviz-rhel.repo
3.安装 FAN repo :
[root@oracle64 Desktop]# wget http://www.fullyautomatednagios.org/FAN/repository/2.4/i386/fan-repo-2.4-fan.1.noarch.rpm
[root@oracle64 Desktop]# yum localinstall --nogpgcheck fan-repo-2.4-fan.1.noarch.rpm
4.64位系统不能这样安装,需要fan_nagios_x86_64.repo.tar.gz包(这个包是我自己新建了一个源),把该包直接解压缩到/etc/yum.repos.d/文件夹即可
三、安装 stable version 2.4
FAN standalone
[root@oracle64 Desktop]# yum install fan-standalone
FAN poller
[root@oracle64 Desktop]# yum install fan-poller
FAN central
[root@oracle64 Desktop]# yum install fan-central
FAN database
[root@oracle64 Desktop]# yum install fan-database
四、用PNP绘制历史曲线
Pnp是一个基于php和perl,用rrdtool将nagios采集的数据绘制图表的工具,所以安装pnp之前必须先安装php、perl和rrdtool。
2.安装需要的插件
yum -y install gcc-c++
yum -y install libxml2-devel
yum -y install pango*
3.安装cgilib
tar zxvf cgilib-0.5.tar.gz
cd cgilib-0.5
cp cgi.h /usr/include
4.安装rrdtool
tar zxvf rrdtool-1.4.5.tar.gz
cd rrdtool
./configure
make all
make install
5.编辑文件添加到最后面
vi /etc/httpd/conf/http.conf
Alias /pnp "/usr/local/nagios/share/pnp"
<Directory "/usr/local/nagios/share/pnp">
Options None
AllowOverride None
Order allow,deny
Allow from all
Authname "nagios access"
Authuserfile /etc/nagios/htpasswd.users
Require valid-user
Authtype basic
</Directory>
6.启动apache和nagios就ok了,浏览器访问http://ip/nagios,nagios默认用户名密码都是nagiosadmin
五、报错
1.网卡流量报错:Return code of 127 is out of bounds - plugin may be missing
/usr/lib/nagios/plugins/该文件夹下面缺少流量检查脚本,然后赋权
ll /usr/lib/nagios/plugins/check_traffic.sh
cd /usr/lib/nagios/plugins
chmod 777 -R plugins
chown -R nagios.nagios plugins
2.vi /etc/httpd/conf/httpd.conf
找到#ServerName www.example.com:80 把#去掉,再重启apache即可
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 172.16.195.101 for ServerName
3.nagios告警全部关掉模块报错
Error: Could not stat() command file '/var/log/nagios/rw/nagios.cmd'!
拷贝一个nagios.cmd文件到下面目录,然后赋权解决
chmod -R 777 /var/log/nagios/rw/
4.CHECK_NRPE: Error - Could not complete SSL handshake.
vi /usr/local/nagios/etc/nrpe.cfg
添加nagios IP地址210.31.118.245
然后重启nrpe
5.这些是只有210.31.118.245 机器ping不通,那就是防火墙屏蔽了,添加
PING CRITICAL - Packet loss = 100%
/sbin/iptables -A INPUT -p icmp -s 210.31.118.245 -j ACCEPT
6.这些都是5666端口telnet不通的,也是防火墙屏蔽了
CHECK_NRPE: Socket timeout after 10 seconds.
CHECK_NRPE: Socket timeout after 10 seconds.
/sbin/iptables -A INPUT -p tcp --dport 5666 -i eth1 -j ACCEPT