Page 1 of 1

Template - custom variables / different amount of interfaces

Posted: Sun Sep 15, 2013 4:32 pm
by ronaldobf
Hi guys.

I am planing my nagios environment and I have some specific situations that I need to monitor only specific interfaces via snmp, and those interfaces vary per host in quantity and identifiers.

Basically, since there are many hosts, I think in creating a template with custom variables for ifIndex and snmp community. Then, applying that template in each host I create, specifying the custom variables per host.
The problem I see in this setup is that I want to monitor only 3 interfaces in a specific host (e.g. ifindex 1, 10 and 20), only 2 in another host (e.g. ifindex 3 and 12) and so on. I could not see a good way to do this.

There are some hosts with more than 50 interfaces that I am supposed to monitor and a single interface for some others.

How can I set up this situation using templates with different amount of interfaces?

Thanks in advance

Re: Template - custom variables / different amount of interf

Posted: Mon Sep 16, 2013 10:12 am
by sreinhardt
That's a tricky one. Templates or service groups may not be the best option, only because of the restriction on being nearly identical. If there were large numbers of devices that need identical monitoring either would work fairly well, but for some of the other ones, you may be better off creating a script that accepts multiple port identifiers after ifIndex and returns the status for each one in a single result. You could also have this script return the performance data for each port on that single check, to give a nice graph of each port on that device. Otherwise, you would probably be best off defining a service template that defines your check and most other critical options, then just defining the service name and ifIndex identifier as an argument within the actual service.

Re: Template - custom variables / different amount of interf

Posted: Thu Sep 19, 2013 11:38 pm
by ronaldobf
Hi. Thanks for replying.

I guess, in my case, I will have to create a single service check for each interface, as your second suggestion. I will collect performance data as well.
To be easy to manage, I will make a script to insert devices into my nagios, and based in which hostgroup(s) I choose, the script will ask for some basic variables, will make some basic validation and, if everything goes fine, it will build the host cfg file with the interfaces service checks automatically, keeping a standard for all the hosts/services.

Thanks

Re: Template - custom variables / different amount of interf

Posted: Fri Sep 20, 2013 11:16 am
by sreinhardt
You're welcome. That sounds like a pretty good idea, just be sure to restart nagios and make sure the directory or files are listed in the nagios.cfg, but I'm sure you get that already! Let us know if you need any further help.