When defining services and check commands in Nagios macros can be used to send data to the external command. My question is … is it possible to modify the host.cfg schema to include community string? Im not sure why it wouldnt already be there. Or is there another way of accomplishing what I am trying to do.
If you look below I am trying to define a generic snmp check command which I them can customize through different services. In the service I do not have to specify the host address as the command picks this up from the host in question through the $HOSTADDRESS$. How can I do this for the community string? We poll devices from different customers which have different community strings. I am trying to avoid duplicating a service for every different customer with a different community string. In the examples below I send argument 1 as the community string “public”, but I’d rather not have to define this and have the command just get this from the host like it did its ip address.
Hope this makes sense… see below for my configs.
An example of my check snmp command looks like this…
command_line $USER1$/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o $ARG2$ -w $ARG3$ -c $ARG4$
The service that alls this command looks like this…
use generic-service ; Name of service template to use
host_name router1 service_description CISCO-CPU-5SEC is_volatile 0 check_period 24x7 max_check_attempts 3 normal_check_interval 5 retry_check_interval 1 contact_groups switch-admins notification_interval 240 notification_period 24x7 notification_options c,r check_command check_snmp!public!.18.104.22.168.22.214.171.124.126.96.36.199.1.6.1!0!1 }