配置nagios出現的錯誤

fei890910發表於2014-02-25
一、nagios 配置過程中驗證環節出現下面錯誤
[root@node1 ~]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Nagios Core 3.4.3
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 11-30-2012
License: GPL
Website:
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/localhost.cfg'...
   Read object config files okay...
Running pre-flight check on configuration data...
Checking services...
Error: Contact group 'admins' specified in service 'Current Load' for host 'node1' is not defined anywhere!
Error: Contact group 'admins' specified in service 'Current Users' for host 'node1' is not defined anywhere!
Error: Contact group 'admins' specified in service 'HTTP' for host 'node1' is not defined anywhere!
Error: Contact group 'admins' specified in service 'PING' for host 'node1' is not defined anywhere!
Error: Contact group 'admins' specified in service 'Root Partition' for host 'node1' is not defined anywhere!
Error: Contact group 'admins' specified in service 'SSH' for host 'node1' is not defined anywhere!
Error: Contact group 'admins' specified in service 'Swap Usage' for host 'node1' is not defined anywhere!
Error: Contact group 'admins' specified in service 'Total Processes' for host 'node1' is not defined anywhere!
        Checked 8 services.
Checking hosts...
Error: Contact group 'node1' specified in host 'node1' is not defined anywhere!
        Checked 1 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 24 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:   9
***> One or more problems was encountered while running the pre-flight check...
     Check your configuration file(s) to ensure that they contain valid
     directives and data defintions.  If you are upgrading from a previous
     version of Nagios, you should be aware that some variables/definitions
     may have been removed or modified in this version.  Make sure to read
     the HTML documentation regarding the config files, as well as the
     'Whats New' section to find out what has changed.
根據上面的提示做如下處理

將templates.cfg配置中的admins組更改為contact.cfg中定義的contactgroup_name      ts 
[root@node1 objects]# vi contacts.cfg 
define contactgroup{
        contactgroup_name       ts
        alias                                Nagios Administrators
        members                        david
        }
define host{
        name                    windows-server  ; The name of this host template
        use                     generic-host    ; Inherit default values from the generic-host template
        check_period            24x7            ; By default, Windows servers are monitored round the clock
        check_interval          5               ; Actively check the server every 5 minutes
        retry_interval          1               ; Schedule host check retries at 1 minute intervals
        max_check_attempts      10              ; Check each server 10 times (max)
        check_command           check-host-alive        ; Default command to check if servers are "alive"
        notification_period     24x7            ; Send notification out at any time - day or night
        notification_interval   30              ; Resend notifications every 30 minutes
        notification_options    d,r             ; Only send notifications for specific host states
        contact_groups          ts              ; Notifications get sent to the admins by default
        hostgroups              windows-servers ; Host groups that Windows servers should be a member of
        register                0               ; DONT REGISTER THIS - ITS JUST A TEMPLATE
        }

重新執行驗證命令,透過驗證
[root@node1 ~]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Nagios Core 3.4.3
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 11-30-2012
License: GPL

Website:
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/localhost.cfg'...
   Read object config files okay...
Running pre-flight check on configuration data...

Checking services...
        Checked 8 services.
Checking hosts...
        Checked 1 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 24 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

二、重啟apache服務出現如下錯誤
[root@node1 ~]#  /usr/local/apache2/bin/apachectl start
httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.10.101 for ServerName

處理 在httpd.conf新增下面一行
[root@node1 conf]# pwd
/usr/local/apache2/conf
[root@node1 conf]# vi httpd.conf
ServerName localhost:80
[root@node1 conf]#  /usr/local/apache2/bin/apachectl restart
[root@node1 conf]# pwd
apache服務重新啟動,錯誤解決



來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29108064/viewspace-1088909/,如需轉載,請註明出處,否則將追究法律責任。

相關文章