How Can new linux hosts inherit a group of services?
Posted: Thu Jul 29, 2010 11:40 am
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!
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!