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…
If I"m not mistaken, $USERx$ macro’s are used to hide sensitive login/password stuff. You would define a check_snmp command in commands.cfg to use -C $USERx$. In your resource.cfg you would define $USER3$=public, $USER4$=secretcomm, and so on. You would then make the resource.cfg file not readable by apache.
For what you are triing to accomplish, you would define a template for each and every UNIQUE community string. If everyone single host has a unique string, then how would that be a timesaver? If you have several that ARE the same, then it would save some time, I suppose. Personally, it looks like more work than it’s worth.
The only problem with using the $USERXX$ variables is that they are not associated with a particular host. We are looking to poll multiple customers (more than 32) which would each use different community strings. Even if I could use more than 32 unique $USERXX$ variables they arent relative to the current host being processed ie. $HOSTADDRESS$.
We’ve used Whats Up Gold in the past and you can assign a unique community string to each host which is used when SNMP type requests are performed against it. Wondering why this functionality wasnt included in Nagios.
If each host has a unique community string, and you are going to be making several service checks for each host, perhaps making a template for each would be the best way, in your services.cfg file. As far as nagios’ limitations, I’m sure there are several. As an end user, I just use what has been given to me for free. Compared to $1,495, I’d say it’s worth the extra effort.