Problem setting up a Distributed Nagios

Yazz Atlas yazz.atlas at gmail.com
Sat May 30 01:48:41 CEST 2009


I'm having a trouble getting a distributed Nagios setup working. I've 
been reading the doc's and searching the web and haven't found a 
solution yet. I'm running on Cento5.3 using the RPM package 
nagios-2.12-5.el5.

My demo setup is I have one Central Nagios and one Distributed Nagios 
server. I'm expecting the Distributed Nagios to monitor a remote hosts. 
For this example demo06.example.com and port HTTP:80. If HTTP doesn't 
respond on send a message using send_nsca (which is in a wrapper script 
called submit_check_results).

So far I can't get the Distributed Nagios to automatically send anything 
to the Central Nagios. I now have been able to send a message from the 
command line to the Central Nagios using submit_check_results.

If I stop HTTP:80 I only see this in my Distributed Nagios nagios.log:

[1243639213] SERVICE ALERT: 
demo06.example.com;HTTP:80;CRITICAL;HARD;1;Connection refused

Now if I run the following by hand it does work.

# submit_check_results demo06.example.com 'HTTP:80' 'CRITICAL' 'SOFT'

#-- Log on Central Nagios --

[1243630843] EXTERNAL COMMAND: 
PROCESS_SERVICE_CHECK_RESULT;demo06.example.com;HTTP:80;2;SOFT
[1243630851] SERVICE ALERT: demo06.example.com;HTTP:80;CRITICAL;HARD;1;SOFT
[1243630851] SERVICE NOTIFICATION: 
yazz.atlas;demo06.example.com;HTTP:80;CRITICAL;notify-service-by-email;SOFT


#-- Distributed nagios.cfg important suff --

ochp_command=submit_host_results
ocsp_command=submit_service_results

obsess_over_services=1
obsess_over_hosts=1
log_notifications=1
enable_notifications=0


# I tried adding this and it did nothing either.
#
#  global_host_event_handler=submit_host_results
#  global_service_event_handler=submit_service_results


#-- Distributed service configuration --

# I simplifed it as much as I could so you can see everything.
# There is some line wrapping from my mail client be warned.

define host {
   host_name                       demo06.example.com
   alias                           demo06
   address                         172.16.7.135
   check_period                    24x7
   max_check_attempts              10
   check_command                   check-host-alive
   notification_period             24x7
   notification_interval           10
   notification_options            d,u,r
   contact_groups                  nsca
   notification_period             24x7
   notifications_enabled           1
   event_handler_enabled           1
   flap_detection_enabled          1
   failure_prediction_enabled      1
   process_perf_data               0
   retain_status_information       0
   retain_nonstatus_information    0
}

define service {
   host_name                       demo06.example.com
   service_description             HTTP:80
   check_command                   check_http_apache!8123
   check_period                    24x7
   contact_groups                  nsca
   obsess_over_service             1
   max_check_attempts              1
   normal_check_interval           1
   retry_check_interval            1
   notification_interval           30
   notification_period             24x7
   notification_options            w,u,c,r,f
   active_checks_enabled           1
   passive_checks_enabled          1
   parallelize_check               1
   obsess_over_service             1
   check_freshness                 1
   notifications_enabled           1
   event_handler_enabled           1
   flap_detection_enabled          1
   failure_prediction_enabled      1
   process_perf_data               0
   retain_status_information       0
   retain_nonstatus_information    0
   is_volatile                     0
}

define hostgroup{
   hostgroup_name  Demo
   alias           Demo Server Host Group
   members         demo06.example.com
   }

define servicegroup{
   servicegroup_name       Demo
   alias                   Demo Service Group
   members                 demo06.example.com,HTTP:80
}

define contactgroup{
   contactgroup_name               nsca
   alias                           nsca
   members                         yazz.atlas
   }

define contact{
   contact_name                    yazz.atlas
   alias                           Yazz Atlas
   email                           yazz.atlas at example.com
   host_notification_period        24x7
   host_notification_options       d,r,f
   host_notification_commands      submit_host_results
   service_notification_period     24x7
   service_notification_options    u,c,r,f
   service_notification_commands   submit_service_results
}

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
}

# Check line wrapping bellow
# submit_check_results comes from:
#  http://nagios.sourceforge.net/docs/2_0/distributed.html
# with little modification made.

define command{
   command_name       submit_host_results
   command_line       $USER1$/submit_check_results $HOSTNAME$ 
'$SERVICEDESC$' $SERVICESTATE$ '$SERVICEOUTPUT$'
   }

define command{
   command_name       submit_service_results
   command_line       /usr/local/sbin/submit_check_results $HOSTNAME$ 
'$SERVICEDESC$' $SERVICESTATE$ '$SERVICEOUTPUT$'
   }


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

define command{
   command_name       check_http_apache
   command_line       $USER1$/check_http -H $HOSTNAME$ -p $ARG1$ -N
}


------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list