监控系统应该从nagios开始,简单易上手,而且很容易能够掌握内部运行机制,了解运行规则,直接贴运行代码:


1安装前准备:
Apache2
GCC编译器与开发库
GD库与开发库
php

2创建帐号:
/usr/sbin/useradd nagios --创建帐号组
mkdir /usr/local/nagios --创建安装目录
chown nagios:nagios /usr/local/nagios --修改目录权限
usermod -G nagios apache --将Web帐号加入nagios组,可以在web操作。


3安装:
wget http://ncu.dl.sourceforge.net/project/nagios/nagios-3.x/nagios-3.2.3/nagios-3.2.3.tar.gz
tar -zxvf nagios-3.2.3.tar.gz
./configure --prefix=/usr/local/nagios
make all
make install -- This installs the main program, CGIs, and HTML files
make install-init -- This installs the init script in /etc/rc.d/init.d
make install-commandmode -- This installs and configures permissions on the
make install-config -- This installs *SAMPLE* config files in /usr/local/nagios/etc
make install-webconf -- This installs the Apache config file for the Nagios

4.配置文件:
more /etc/httpd/conf.d/nagios.conf
¥¥¥AuthUserFile /usr/local/nagios/etc/htpasswd.users
cp /etc/httpd/conf.d/nagios.conf /var/www/html/
nagios页面访问账号:
/usr/bin/htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
New password: --nagiosadmin 帐号权限已经默认设置了。
Re-type new password: --配置文件看/usr/local/nagios/etc/nagios.cfg
Adding password for user root --重点/usr/local/nagios/etc/cgi.cfg


这里注意: nagiosadmin作为默认用户是用从WEB页面直接操作CGI功能,换句话说也就可以在页面中直接进行操作,如果需要修改用户名,那么需要在/usr/local/nagios/etc/cgi.cfg 赋予新永明WEB页面操作权限,当然一般使用nagios就不建议采用页面操作。


log日志
touch /usr/local/nagios/var/nagios.log
chown nagios:nagios /usr/local/nagios/var/nagios.log
5.配置开机启动:
设置nagios为开机启动
[root@localhostnagios]# chkconfig nagios on
[root@localhostnagios]# service nagios start
[root@localhost soft]# service httpd restart
6.测试
http://192.168.28.X/nagios/

安装首要插件:nagios-plugins