Config Organization


#1

Hello everyone.

I’ve been working with Nagios 2.5 for over a year now. I inherited this project, when I started at this job Nagios was already installed and I put in charge of it since I have experience with linux systems and it was installed on a linux box.

So I started reading up on it and I learned how to add hosts to the config files, add services, etc…

My problem is, the person that setup the config before me has it setup kinda weird I think. I’m not sure if this is the “normal” way to set things up, but it seems like it’s more work than it needs to be.

There is a service definition for every single host, which doesn’t seem right to me. Take a look at this snippet from my ping-service.cfg file:

[code]define service{
name ping-generic-service
active_checks_enabled 1
passive_checks_enabled 1
parallelize_check 1
obsess_over_service 1
check_freshness 0
notifications_enabled 1
event_handler_enabled 1
flap_detection_enabled 1
failure_prediction_enabled 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
is_volatile 0
check_period 24x7
max_check_attempts 4
normal_check_interval 5
retry_check_interval 1
check_command check_ping!3000.0,80%!5000.0,100%
register 0
}

define service{
use ping-generic-service
host_name HOST01
service_description PING
contact_groups admins,helpdesk
notification_options w,u,c,r
notification_interval 5
notification_period 24x7
}

define service{
use ping-generic-service
host_name HOST02
service_description PING
contact_groups admins,helpdesk
notification_options w,u,c,r
notification_interval 5
notification_period 24x7
}

define service{
use ping-generic-service
host_name HOST03
service_description PING
contact_groups admins,helpdesk
notification_options w,u,c,r
notification_interval 5
notification_period 24x7
}[/code]

This list continues for every single host that nagios monitors. I would think it would be easier to define the “ping-generic-service” once, then for the “host_name” field i would just put the list of hosts in there (i.e. HOST01,HOST02,HOST03). note that I changed these names for the sake of this post.

So is this the normal way of doing it? Its is such a pain to add or remove a host from nagios because if I need to remove one, i need to search every config file for the host, and there could be hundreds of service checks to look through.

By the way, whoever set this up did the same thing for every service, like the “CPU_USAGE”, we have that service on about 20 hosts, and whoever set it up defined the service 20 times! i would think once would be enough.

We monitor about 300 hosts so i would think there is an easier way to do this.

Thanks in advance.


#2

bump.


#3

Have you tried reading the documentation where it says exactly what you said in your post? (i.e. list multiple hosts separated by commas)