歡迎您光臨本站 註冊首頁

nagios!!!!not defined anywhere!

←手機掃碼閱讀     火星人 @ 2014-03-03 , reply:0

nagios!!!!not defined anywhere!

# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 3.2.0
Copyright (c) 2009 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-12-2009
License: GPL

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

Running pre-flight check on configuration data...

Checking services...
Error: Service check command 'check-host-alive' specified in service 'check-host-alive' for host 'nagios-server' not defined anywhere!
Error: Service check command 'check-host-alive' specified in service 'check-host-alive' for host 'rhel5-77' not defined anywhere!
Error: Service check command 'check-host-alive' specified in service 'check-host-alive' for host 'rhel5-99' not defined anywhere!
        Checked 3 services.
Checking hosts...
Error: Host check command 'check-host-alive' specified for host 'nagios-server' is not defined anywhere!
Error: Host check command 'check-host-alive' specified for host 'rhel5-77' is not defined anywhere!
Error: Host check command 'check-host-alive' specified for host 'rhel5-99' is not defined anywhere!
        Checked 3 hosts.
Checking host groups...
        Checked 1 host groups.
Checking service groups...
        Checked 0 service groups.
Checking contacts...
Error: Service notification command 'service-notify-by-email' specified for contact 'nagiosadmin' is not defined anywhere!
Error: Host notification command 'host-notify-by-email' specified for contact 'nagiosadmin' is not defined anywhere!
        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 0 commands.
Checking time periods...
        Checked 1 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:   8

***> 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.

# cat commands.cfg
define command{
        command_name    check_nrpe
        command_line    $USE 1$/check_nrpe -H $HOSTADD ESS$ -c $A G1$
        }

#host-notify-by-sms  
define command {
       command_name      host-notify-by-sms
       command_line      /usr/local/bin/sms_send "Host $HOSTSTATE$ alert for $HOSTNAME$! on '$DATETIME$' " $CONTACTPAGER$
       }


define command{
        command_name check-host-alive
        command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5
        }

define command{
        command_name host-notify-by-email
        command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState:$
HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Al
ert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
        }

哪位碰到過這個問題,請指明改正錯誤配置,謝謝!!
《解決方案》

Checking services...
Error: Service check command 'check-host-alive' specified in service 'check-host-alive' for host 'nagios-server' not defined anywhere!

check-host-alive服務沒有定義
Error: Service check command 'check-host-alive' specified in service 'check-host-alive' for host 'rhel5-77' not defined anywhere!
Error: Service check command 'check-host-alive' specified in service 'check-host-alive' for host 'rhel5-99' not defined anywhere!
同上


Host check command 'check-host-alive' specified for host 'nagios-server' is not defined anywhere!
Error: Host check command 'check-host-alive' specified for host 'rhel5-77' is not defined anywhere!
Error: Host check command 'check-host-alive' specified for host 'rhel5-99' is not defined anywhere!
三台主機都沒有定義

nagios裡面主要是將定義的配置文件分類列出,nagios作為主要配置文件。
然後分別定義template.cfg、timeperiod.cfg、contact.cfg分別配置,每台host.cfg單獨配置,然後用cfg_file='hosts.cfg'導入到nagios主配置文件裡面去。
《解決方案》

# cat contactgroups.cfg
define contactgroup {
        contactgroup_name lq2003
        alias system administrator group
        members nagiosadmin
}
《解決方案》

# cat contacts.cfg
define contact {
        contact_name nagiosadmin
        alias system administrator
        service_notification_period 24x7
        host_notification_period 24x7
        service_notification_options w,u,c,r
        host_notification_options d,u,r
        service_notification_commands service-notify-by-email
        host_notification_commands host-notify-by-email
        email liqiang@channelsoft.com
             }
《解決方案》

# cat hostgroups.cfg
define hostgroup {
         hostgroup_name lq2003
         alias          test
         members rhel5-77,rhel5-99,nagios-server
         }


# cat hosts.cfg
define host {
       host_name nagios-server
       alias     nagios-server
       address   192.168.1.45
       contact_groups lq2003
       check_command check-host-alive
       max_check_attempts 5
       notification_interval 10
       notification_period 24x7
       notification_options d,u,r
       }

define host {
       host_name rhel5-99
       alias     rhel5-99
       address 192.168.1.99
       contact_groups lq2003
       check_command check-host-alive
       max_check_attempts 5
       notification_interval 10
       notification_period 24x7
       notification_options d,u,r
       }
define host {
       host_name rhel5-77
       alias     rhel5-77
       address 192.168.1.77
       contact_groups lq2003
       check_command check-host-alive
       max_check_attempts 5
       notification_interval 10
       notification_period 24x7
       notification_options d,u,r
       }
《解決方案》

# cat services.cfg
define service {
        host_name nagios-server
        service_description check-host-alive
        check_period 24x7
        max_check_attempts 4
        normal_check_interval 3
        retry_check_interval 2
        contact_groups lq2003
        notification_interval 10
        notification_period 24x7
        notification_options w,u,c,r
        check_command check-host-alive
        }
define service {
        host_name rhel5-77
        service_description check-host-alive
        check_period 24x7
        max_check_attempts 4
        normal_check_interval 3
        retry_check_interval 2
        contact_groups lq2003
        notification_interval 10
        notification_period 24x7
        notification_options w,u,c,r
        check_command check-host-alive
        }
define service {
        host_name rhel5-99
        service_description check-host-alive
        check_period 24x7
        max_check_attempts 4
        normal_check_interval 3
        retry_check_interval 2
        contact_groups lq2003
        notification_interval 10
        notification_period 24x7
        notification_options w,u,c,r
        check_command check-host-alive
        }
《解決方案》

# cat  timeperiods.cfg
define timeperiod{
        timeperiod_name 24x7
        alias 24 Hours A Day, 7 Days A Week
        sunday 00:00-24:00
        monday 00:00-24:00
        tuesday 00:00-24:00
        wednesday 00:00-24:00
        thursday 00:00-24:00
        friday 00:00-24:00
        saturday 00:00-24:00
        }
《解決方案》

的確不好意思啊!

這個問題困擾了我好久,真的查不出來是那裡的問題!!謝謝各位
《解決方案》

# cat hosts.cfg
                                                                                                      
define host{

           host_name                                    nagios-server

           alias                                        nagios-server

           address                                      192.168.1.45

        #   parents                                      server-backbone
           check_command                             check-host-alive

          check_interval                            5

          retry_interval                            1

          max_check_attempts                        5

          check_period                              24x7

          process_perf_data                         0

          retain_nonstatus_information              0

          contact_groups                            lq2003

          notification_interval                     30

          notification_period                       24x7

          notification_options                      d,u,r

          }
define host{

           host_name                                    rhel5-99

           alias                                        rhel5-99

           address                                      192.168.1.99

        #   parents                                      server-backbone
           check_command                             check-host-alive

          check_interval                            5

          retry_interval                            1

          max_check_attempts                        5

          check_period                              24x7

          process_perf_data                         0

          retain_nonstatus_information              0

          contact_groups                            lq2003

          notification_interval                     30

          notification_period                       24x7

          notification_options                      d,u,r

          }
define host{

           host_name                                    rhel5-77

           alias                                        rhel5-77

           address                                      192.168.1.77

        #   parents                                      server-backbone
           check_command                             check-host-alive

          check_interval                            5

          retry_interval                            1

          max_check_attempts                        5

          check_period                              24x7

          process_perf_data                         0

          retain_nonstatus_information              0

          contact_groups                            lq2003

          notification_interval                     30

          notification_period                       24x7

          notification_options                      d,u,r

          }
《解決方案》


Processing object config file '/usr/local/nagios/etc/dd/contactgroups.cfg'...
Processing object config file '/usr/local/nagios/etc/dd/contacts.cfg'...
Processing object config file '/usr/local/nagios/etc/dd/hostgroups.cfg'...
Processing object config file '/usr/local/nagios/etc/dd/hosts.cfg'...
Processing object config file '/usr/local/nagios/etc/dd/services.cfg'...
Processing object config file '/usr/local/nagios/etc/dd/timeperiods.cfg'...
   Read object config files okay...


你的command.cfg文件是定義了check-host-alive命令,但是你的command.cfg文件有包含進nagios.cfg主配置文件么?

nagios裡面最基本的幾個對象:command、template、service、contact、timeperiod最好都是分開寫配置文件,然後cfg_file="*.cfg"的方式導入到主配置文件中去

[火星人 ] nagios!!!!not defined anywhere!已經有1427次圍觀

http://coctec.com/docs/service/show-post-2629.html