步骤7:编译和安装nagios插件。
这儿已经下载了nagios插件在/root/nagios目录下面,直接进去编译和安装即可:
[root@taoteng nagios]# tar -zxvf nagios-plugins-1.5
[root@taoteng nagios]# ./configure --with-nagios-user=nagios --with-nagios-group=nagios
[root@taoteng nagios]# make
[root@taoteng nagios]# make install
步骤8:验证nagios配置文件的是否有错误(这就是nagios其中的一个很不错的地方,可以很清晰的告诉你是否有错误)如果没有什么错误就输出下面的语句:
[root@taoteng nagios]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfgs
输出示例:
Running pre-flight check on configuration data...
Checking services...
Checked 34 services.
Checking hosts...
Checked 14 hosts.
Checking host groups...
Checked 4 host groups.
Checking service groups...
Checked 2 service groups.
Checking contacts...
Checked 1 contacts.
Checking contact groups...
Checked 1 contact groups.
Checking service escalations...
Checked 0 service escalations.
Checking service dependencies...
Checked 0 service dependencies.
Checking host escalations...
Checked 0 host escalations.
Checking host dependencies...
Checked 0 host dependencies.
Checking commands...
Checked 25 commands.
Checking time periods...
Checked 5 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...
Total Warnings: 0
Total Errors: 0
Things look okay - No serious problems were detected during the pre-flight check
步骤9:让Nagios服务随计算机开机启动
为了是Nagios和httpd在重启之后工作,我们需要把这两个服务chkconfig一下:
[root@taoteng ~]# chkconfig --add nagios
[root@taoteng ~]#chkconfig --level 35 nagios on
[root@taoteng ~]#chkconfig --add httpd
[root@taoteng ~]#chkconfig --level 35 httpd on
重启Nagios使更改生效!
[root@taoten ~]#service nagios restart
步骤10:通过浏览器来登录到Nagios
我们的Nagios已经可以开始工作了,浏览器中输入http://192.168.162.153/nagios;输入“nagiosadmin”然后输入密码就okay了!
Nagios Login

主机概述:

Nagios Overview

Nagios Overview
所有的服务概述:

进程概述:

Congratulations! You’ve successfully installed and configured Nagios and its Plugins. You’ve just begin your journey into monitoring.
!!升级nagios到新版本!!
如果你已经安装了一个老版本的nagios,那么你可以直接下载最新版本的nagios,按照下面的命令直接编译安装即可
[root@taoteng ~]# service nagios stop
[root@taoteng ~]# tar –zxvf nagios-4.0.1.tar.gz
[root@taoteng ~]# cd nagios-4.0.1
[root@taoteng ~]# ./configure
[root@taoteng ~]# make all
[root@taoteng ~]# make install
[root@taoteng ~]# service nagios start
到这里,nagios的基本配置已经完成,当然安装过程中n难免会出现错误的~会在后续的过程中更新出来当然也非常欢迎友友联系我一起来交流解决您碰见的问题。
