On Nov 27, 2009, at 11:47 AM, D G Teed wrote:

> I'm looking for a streamlined method of configuring the check_fping
> test for hundreds of network switches.
> 
> Looking at the examples I see for hosts and hostgroup configuration,
> 
> e.g.: 
> http://sourceforge.net/mailarchive/message.php?msg_name=5caea3690911120551o40031fe3o3994b8fc8b463143%40mail.gmail.com
> 
> I can't see doing it that way, with a list of 400+ IPs in a single hostgroup.
> There must be a better way to do this.

Different problem. If you're just wanting to ping them, the only purpose of the 
hostgroup would just be to group them for display in the GUI. You do need them 
in a hostgroup for that. They should be in a hostgroup anyway though, it's just 
better in the long-run.

> With the fping command (not check_fping) I can feed it a list of IPs
> to check from a file.  If I ran fping with -a and did a diff between
> that output and my original list of IPs, I'd get a report of which switches 
> are
> down.  I could write a shell script to do this and set up a cron in less time
> than it would take to do the same in nagios with my current knowledge
> of the configuration options in nagios.  

fping != nagios in the same way that a bicycle != an 18 wheeler. Each solves 
different problem statements and their complexity relates directly to their 
functionality. fping may be the tool for you if that's all you need or until 
you get familiar with nagios configuration (and develop your workflow). I'm a 
hands-on kind of learner and I personally think you're not going to really 
learn it until you do it though.

> I saw this example:
> http://nagios.sourceforge.net/docs/3_0/monitoring-routers.html
> but I don't get "allhosts, switches" in the hostgroups configuration.
> Is this some sort of keyword or built-in wildcard?

No, they're not keywords, the names are arbitrary but hopefully 
representational. They're real hostgroup{}s with appropriate members (or a 
wildcard member for allhosts presumably) created by you if you like those names.

It should be fairly straightforward for you...

You'll first need to create a hostgroup{} definition to contain all the 
switches. - 
http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html#hostgroup

define hostgroup{
        hostgroup_name switches
        alias All Your Switches Are Belong To Us
}

There are at least 3 ways to associate your switches with this hostgroup. I 
purposely avoided using a 'members' directive with a wildcard because you may 
one day monitor more than just these switches... I also didn't list out each 
switch in the members line either. You could do it, but it gets messy to manage 
by hand. A third way, and most flexible, is below.

Next, you'll need to create a host{} definition for each of your switches. Your 
script-fu powers should come in handy here (i.e. a long one-liner awk should do 
it). Besides the usual required parameters, be sure to set the 'hostgroups' 
parameter to 'switches' to include it in the group above -- 
http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html#host

define host{
        host_name       cool_switch
        alias           Freezer Switch
        address         192.168.1.2
        hostgroups      switches
        check_command   check_fping ;(or whatever it's called)
        check_period    24x7 ; (or whatever your schedule is)
        check_interval  5 ; (or whatever your schedule is)
        retry_interval  1 ; (or whatever your schedule is)
        other required parameters   ...
}

Make sure that these directives are put in a cfg_file that nagios reads, verify 
your config (/path/to/nagios -f /path/to/nagios.cfg), fix any problems, start 
nagios and voila. Not as good as home made bread but tasty none-the-less...

--
Marc


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Nagios-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

Reply via email to