安装nagios出现的错误

最近安装nagios时,检查的的状态都没有什么问题,就是监控系统的状态显示不出来

检测的结果如下:

[root@lb02 ~]# /etc/init.d/httpd start
Starting httpd: 
You have new mail in /var/spool/mail/root
[root@lb02 ~]# 
[root@lb02 ~]# 
[root@lb02 ~]# /etc/init.d/nagios checkconfig
Running configuration check...
Nagios Core 3.5.1
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-30-2013
License: GPL

Website: http://www.nagios.org
Reading configuration data...
   Read main config file okay...
Processing object config file '/usr/local/nagios/etc/objects/commands.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/contacts.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/timeperiods.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/templates.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/hosts.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/services.cfg'...
Processing object config directory '/usr/local/nagios/etc/objects/services'...
   Read object config files okay...

Running pre-flight check on configuration data...

Checking services...
    Checked 12 services.
Checking hosts...
    Checked 2 hosts.
Checking host groups...
    Checked 1 host groups.
Checking service groups...
    Checked 0 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

查看nagios日志的内容:

[root@lb02 var]# tail nagios.log
[1536369288] LOG VERSION: 2.0
[1536369288] Finished daemonizing... (New PID=1423)
[1536369288] Error: Could not create external command file '/usr/local/nagios/var/rw/nagios.cmd' as named pipe: (2) -> No such file or directory.  If this file already exists and you are sure that another copy of Nagios is not running, you should delete this file.
[1536369288] Bailing out due to errors encountered while trying to initialize the external command file... (PID=1423)
[1536369446] Nagios 3.5.1 starting... (PID=1502)
[1536369446] Local time is Sat Sep 08 09:17:26 CST 2018
[1536369446] LOG VERSION: 2.0
[1536369446] Finished daemonizing... (New PID=1503)

错误原因:大致是我不能创建nagios.cmd,到/usr/local/nagios/var目录下竟然发现没有rw目录,创建之后重新加载nagios

[root@lb02 var]# mkdir rw
[root@lb02 var]# chown -R nagios.nagios rw
[root@lb02 var]# ll
total 40
drwxrwxr-x 2 nagios nagios  4096 Sep  6 12:55 archives
-rw-r--r-- 1 nagios nagios     5 Sep  8 09:23 nagios.lock
-rw-rw-r-- 1 nagios nagios  3991 Sep  8 09:23 nagios.log
-rw-r--r-- 1 nagios nagios 17051 Sep  8 09:23 objects.cache
-rw-rw-r-- 1 nagios nagios     0 Sep  8 09:23 retention.dat
drwxr-xr-x 2 nagios nagios  4096 Sep  8 09:25 rw
drwxr-xr-x 3 root   root    4096 Sep  6 12:55 spool

此时才加载到正确的监控效果。

原文地址:https://www.cnblogs.com/sykblogs/p/9607937.html