How Can new linux hosts inherit a group of services?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
ppresto
Posts: 17
Joined: Mon Jul 26, 2010 10:16 am

How Can new linux hosts inherit a group of services?

Post by ppresto »

I need to make sure I have a way to create services that can all be targeted to a new host that is added to the network. This will allow me to get a standard host being monitored very quickly, and give me a single area to make global changes. Of course there will be the one offs that need different thresholds and I believe that will be easy to configure when needed. I'm trying to test this out with a single service. I'm using check_snmp_storage.pl script and haven't been able to get it working. I can't get the snmp storage service to show up on my newly added linux host. If I create this service in the new linux host I can get it working but that defeats the purpose of inherting services.

Please Help! I'm new to nagios and I'm sure I'm probably missing something in my logic or syntax somewhere...

Here are the steps I took. I used the nagiosxi interface, but I'm providing the config file data.

1. Create the command
define command {
command_name check_snmp_storage.pl
command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ -C $_SERVICESNMPCOMMUNITY$ -2 -f $ARG1$
}
(_SERVICESNMPCOMMUNITY is a custom variable currently in xiwizard_snmp_service template with my community string). I already tested the custom variable approach and was able to get this piece working when I created the service specifically for my new linux host.

2. Create a hostgroup that all similar hosts will be added to.
define hostgroup {
hostgroup_name linux-servers
alias Linux Servers
members ilsb0001.test.qintra.com
}

3. Create a service template that runs check_snmp_storage.pl and assign it to a hostgroup
define service {
name snmp_service_storage
hostgroup_name linux-servers
use xiwizard_snmp_service
check_command check_snmp_storage.pl!-m/ -w80 -c90
process_perf_data 1
retain_status_information 1
register 0

}

4. I created a host using the snmp wizard and added it to the hostgroup (linux-servers)
define host {
host_name ilsb0001.test.qintra.com
use xiwizard_generic_host
address ilsb0001.test.qintra.com
hostgroups linux-servers
max_check_attempts 5
check_interval 5
retry_interval 1
contact_groups admins
notification_interval 60
icon_image snmp.png
statusmap_image snmp.png
_xiwizard snmp
register 1
}

I would assume any host added to the linux-servers group should inherit the snmp_service_storage template and I should see this service being monitored. I'm not seeing any new service, and I'm not aware of any errors.

Thank you!
mmestnik
Posts: 972
Joined: Mon Feb 15, 2010 2:23 pm

Re: How Can new linux hosts inherit a group of services?

Post by mmestnik »

Only objects that are registered will effect the way Nagios behaves and the screens displayed.

You need to register the service, thus it shouldn't be a template. If you wanted you could use this template to create several registered services.
ppresto
Posts: 17
Joined: Mon Jul 26, 2010 10:16 am

Re: How Can new linux hosts inherit a group of services?

Post by ppresto »

I finally got this working. I was creating a services template in the GUI and I guess this wasn't the right area. I removed my service template and just created a normal service in the GUI and assigned that to my host group and now it works as expected. I'm not sure why using service templates didn't work but I have it running now.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: How Can new linux hosts inherit a group of services?

Post by Box293 »

You are on the right track.

A template must be applied to a service and the inherritance settings need to be correct for them to apply.

Click the help ? next to + null standard for a more detail about inheritance.

A template could be used to apply default settings to a number of hosts. Like the check interval.

You could create a template that defines the check interval (say 20 minutes) and apply that template to each service that you want checked every 20 minutes.

If you later wanted to change it to 30 minutes, you would only need to change it in the template.

This requires you to not define the check interval on each service you apply the template to.

The same applies for a check command.

You can configure a check command in your template, in the $ARGx$ fields you can use variables like $HOSTADDRESS$.

When the template is applied to a service, you must not select a check command from the drop down list, otherwise the template settings will be ignored.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked