发布于 2016-01-02 21:14:49 | 199 次阅读 | 评论: 0 | 来源: PHPERZ
Nagios Linux平台下网络监视工具
Nagios是一款开源的免费网络监视工具,能有效监控Windows、Linux和Unix的主机状态,交换机路由器等网络设置,打印机等。在系统或服务状态异常时发出邮件或短信报警第一时间通知网站运维人员,在状态恢复后发出正常的邮件或短信通知。
检查包是否安装,因为Nagios需要依赖这些包提供服务
[root@bogon nagios]# rpm -q gcc glibc glibc-common gd gd-devel xinetd openssl-devel
[root@bogon nagios]#yum install -y gd gd-devel xinetd openssl-devel
建立nagios账号
[root@bogon ~]# useradd nagios -s /sbin/nologin
[root@bogon ~]# mkdir /usr/local/nagios
[root@bogon ~]# chown -R nagios.nagios /usr/local/nagios/
下载地址
你可以通过下面链接地址http://www.nagios.org/download/plugins/ 下载各种插件。
Nagios Addons是Nagios 扩展项目,
解压安装文件
[root@bogon nagios]# tar zxvf nagios-3.5.0.tar.gz
[root@bogon nagios]# cd nagios
编译安装包
[root@bogon nagios]# ./configure --prefix=/usr/local/nagios/
[root@bogon nagios]# make all
[root@bogon nagios]# make install
[root@bogon nagios]# make install-init
[root@bogon nagios]# make install-commandmode
[root@bogon nagios]# make install-config
安装Nagios 插件
[root@bogon nagios]# tar zxvf nagios-plugins-1.4.16.tar.gz
[root@bogon nagios]# cd nagios-plugins-1.4.16
[root@bogon nagios-plugins-1.4.16]# ./configure --prefix=/usr/local/nagios
[root@bogon nagios]#make && make install
Apache基本配置
[root@bogon nagios-plugins-1.4.16]# cd /usr/local/apache/conf/
[root@bogon conf]# vim httpd.conf
ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"
<Directory "/usr/local/nagios/sbin">
AuthType Basic
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthUserFile /usr/local/nagios/etc/htpasswd
Require valid-user
</Directory>
Alias /nagios "/usr/local/nagios/share"
<Directory "/usr/local/nagios/share">
AuthType Basic
Options None
AllowOverride None
Order allow,deny
Allow from all
AuthName "nagios Access"
AuthUserFile /usr/local/nagios/etc/htpasswd
Require valid-user
</Directory>
[root@bogon conf]# htpasswd -c /usr/local/nagios/etc/htpasswd nagios
启动Nagios服务
[root@bogon conf]# service nagios start
客户端需要安装nrpe插件