1. 程式人生 > >安裝nagios出現的錯誤

安裝nagios出現的錯誤

man obj roo services tor pid lsi init.d depend

最近安裝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

此時才加載到正確的監控效果。

安裝nagios出現的錯誤