Setting up Host Groups in Nagios 2.x

Jim Avery jim at jimavery.me.uk
Tue Apr 21 14:03:42 CEST 2009


2009/4/20 Dei Bertine <deibertine at yahoo.com>:
> Thank you Jim.
> I was hoping to find a step by step direction on this other than the default
> documentation posted.
> I followed through but did not work which I'm unable to see the host group
> details in the admin page.
> I defined the host group under hostgroups path verified without errors:
>
> define hostgroup{
>         hostgroup_name          inf-servers
>         alias                         SERVERS
>         members                 server1,server2,server3,server4,server5
>         }
>
> Any tips on how to get started on organizing all of my servers into one
> hostgroup file?
>
> Thanks again.


Forgive me, I just read the doc I posted and realised it doesn't
contain probably the most important information!

The easiest (in my experience) way to put hosts in to host groups is
by specifying the hostgroups in the host definition.

For example,  you create a file
/usr/local/nagios/etc/objects/hostgroups.cfg which just contains the
hostgroups and nothing else for example:

define hostgroup{
  hostgroup_name  app-ftp
  alias           Application = FTP Server
}
define hostgroup{
  hostgroup_name  app-web
  alias           Application = Web Server
}

Then you can assign hosts to hostgroups in the host definition (which
you might for example put in a file
/usr/local/nagios/etc/objects/hosts.cfg).  These will look something
like this:

define host{
  use             host-bronze,logo-windows_server,generic-host
  host_name       server001
  alias           server001 web and ftp server
  address         192.168.1.2
  hostgroups     app-ftp,app-web
  parents         switch002
}


If/when you upgrade to Nagios3, you'll notice there are even more
powerful tricks you can use for inheritance of objects from multiple
templates.

I hope this helps.

I can heartily recommend you read the book "Nagios" by Wolfgang Barth.
 http://nostarch.com/nagios_2e.htm  .  It gives an excellent
introduction to how Nagios works, how to set up the configuration
files, how to monitor various kinds of nodes and server and some of
the useful add-ons available for Nagios.  The 2nd edition mainly
covers Nagios version 3, so you might need to bear in mind that there
are some differences or possibly consider purchasing the 1st edition
(if it's still available) which covers Nagios version 2.

Cheers,

Jim

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
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





More information about the Users mailing list