nagios在AX3.0上的应用
时间:2009-03-02 来源:Joken
Nagios是一款用于系统和网络监控的应用程序。它可以在你设定的条件下对主机和服务进行监控,在状态变差和变好的时候给出告警信息。
Nagios最初被设计为在Linux系统之上运行,然而它同样可以在类Unix的系统之上运行。
Nagios更进一步的特征包括:
- 监控网络服务(SMTP、POP3、HTTP、NNTP、PING等);
- 监控主机资源(处理器负荷、磁盘利用率等);
- 简单地插件设计使得用户可以方便地扩展自己服务的检测方法;
- 并行服务检查机制;
- 具备定义网络分层结构的能力,用"parent"主机定义来表达网络主机间的关系,这种关系可被用来发现和明晰主机宕机或不可达状态;
- 当服务或主机问题产生与解决时将告警发送给联系人(通过EMail、短信、用户定义方式);
- 具备定义事件句柄功能,它可以在主机或服务的事件发生时获取更多问题定位;
- 自动的日志回滚;
- 可以支持并实现对主机的冗余监控;
- 可选的WEB界面用于查看当前的网络状态、通知和故障历史、日志文件等;
Nagios所需要的运行条件是机器必须可以运行Linux(或是Unix变种)并且有C语言编译器。你必须正确地配置TCP/IP协议栈以使大多数的服务检测可以通过网络得以进行。
你需要但并非必须正确地配置Nagios里的CGIs程序,而一旦你要使用CGI程序时,你必须要安装以下这些软件...
而今天,nagios已经更新为可以在线更新日志等功能,更加方便网络管理员偷懒。。^_^,而且nagios的警报系统也很强大,不仅支持一遍的email警报还支持手机短信警报。。这么好的一个软件需要学习学习。。。
下面,简单介绍一下nagios在redflag asianux 3.0 上面的安装。。。
首先,要准备的是apache,nagios用户。根据nagios官方网站上的一些介绍,需要支持的httpd要2.2以上的版本。。
[root@localhost test]# rpm -qa | grep httpd
httpd-devel-2.2.3-11.3.2AXS3
httpd-manual-2.2.3-11.3.2AXS3
httpd-2.2.3-11.3.2AXS3
启动httpd,
[root@localhost test]# service httpd start
启动 httpd: [确定]
[root@localhost test]#
保证能够正常启动。
开始安装nagios的主程序跟插件包
下载:nagios-3.0rc1.tar.gz,nagios-plugins-1.4.11.tar.gz,
[root@localhost test]# tar xvzf nagios-3.0rc1.tar.gz
[root@localhost test]# cd nagios-3.0rc1
记住,先要配置好用户组,不然编译的过程会报错
[root@localhost test]#useradd nagios
[root@localhost test]#passwd nagios
[root@localhost test]#groupadd nagcmd
[root@localhost test]#usermod -G nagios
[root@localhost test]#usermod -G nagcmd nagios
[root@localhost test]#usermod -G nagcmd apache
编译nagios主程序:
[root@localhost nagios-3.0rc1]#./configure --with-command-group=nagcmd
[root@localhost nagios-3.0rc1]#make all
[root@localhost nagios-3.0rc1]#make install
[root@localhost nagios-3.0rc1]#make install-init
[root@localhost nagios-3.0rc1]#make install-config
[root@localhost nagios-3.0rc1]#make install-commandmode
配置web访问页面:
[root@localhost ~]#vi /usr/local/nagios/etc/objects/contacts.cfg
[root@localhost nagios-3.0rc1]#make install-webconf
[root@localhost ~]#htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
安装nagios插件:
[root@localhost test]#cd nagios-plugins-1.4.11
[root@localhost nagios-plugins-1.4.11]#./configure --with-nagios-user=nagios --with-nagios-group=nagios
[root@localhost nagios-plugins-1.4.11]#make
[root@localhost nagios-plugins-1.4.11]#make install
[root@localhost nagios-plugins-1.4.11]#chkconfig --add nagios
[root@localhost nagios-plugins-1.4.11]#chkconfig nagios on
[root@localhost nagios-plugins-1.4.11]#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
[root@localhost nagios-plugins-1.4.11]#service nagios start
配置windows机器管理:
[root@localhost ~]#vi /usr/local/nagios/etc/nagios.cfg
把cfg_file=/usr/local/nagios/etc/objects/windows.cfg,注释去掉,配置windows主机IP,记得把email地址该为自己的email地址,方便了解情况。
[root@localhost ~]# vi /usr/local/nagios/etc/objects/windows.cfg编辑下面内容:
define host{
use windows-server ; Inherit default values from a template
host_name winserver ; The name we're giving to this host
alias My Windows Server ; A longer name associated with the host
address 192.168.228.234 ; IP address of the host
}
然后在机器上面输入:http://192.168.228.242/nagios
回车后输入用户名密码后就可以出现web管理界面来管理网络中的计算机,可以查看计算机的工作情况已经计算机在这个网络中的一些日志警报之类的,很详细。。很好~!!值得好好用的一个软件。。。同样的,对监控的计算机处于安全下,网管就可以睡懒觉,再说如果有问题,第一时间就会通知到你(短信方式)。。。^_^