Clarification need on configuring nagios to monitor multiple hosts

Jim Avery jim at jimavery.me.uk
Wed Jul 13 13:50:21 CEST 2011


On 13 July 2011 12:24, Zama Ques <queszama at yahoo.in> wrote:
>
> Hi All ,
>
> I am new to nagios configuration . I  successfully installed nagios on one of my linux server  and now monitoring two hosts .


Welcome!  You've made a good start there.


> For monitoring of remote hosts , I created a new config file by renaming localhost.cfg file under objects directory.
>
> I renamed the entries "hostname" and "address"  and other entries under "DEFINE HOST" directive to point to the new server which I am planning to monitor . The settings looks like this
>
> define host{
>         use                     linux-server            ; Name of host template to use
>                             ; This host definition will inherit all variables that are defined
>                             ; in (or inherited by) the linux-server host template definition.
>         host_name               node1
>         alias                         node1
>         address                   192.168.122.167
>         }
>
>
> define host{
>         use                     linux-server            ; Name of host template to use
>                                    ; This host definition will inherit all variables that are defined
>                                    ; in (or inherited by) the linux-server host template definition.
>         host_name          node2
>         alias                    node2
>         address              192.168.122.218
>         }
>

Those look fine.


> Also modified "DEFINE SERVICE"  directive to monitor few services on both the remote hosts . Few of the settings looks like this
>
> define service{
>         use                             local-service         ; Name of service template to use
>         host_name                       node1
>         service_description             Current Users
>     check_command            check_nrpe!check_users
>         }
>
>
> define service{
>         use                             local-service         ; Name of service template to use
>         host_name                       node2
>         service_description             Current Users
>     check_command            check_nrpe!check_users
>         }
>
> The checks are working fine . But my confusion here is in terms of scalabilty .
> What if I want to monitor 100 servers and 5 services in each of the servers. Does that mean I need to create 100 "define host"  directives for each of these servers . Also , monitoring 5 services means i have to create 5 "define service" for each host , that means 500 "define service" directives.
> If this is the case , then it will be really painful to configure and manage if there are many servers to monitor.


You'll find useful help on that here:

http://nagios.sourceforge.net/docs/nagioscore/3/en/objecttricks.html




> Can't I use comma separated ip address and hosts like this
>
> define host{
>         use                     linux-server            ; Name of host template to use
>                             ; This host definition will inherit all variables that are defined
>                             ; in (or inherited by) the linux-server host template definition.
>         host_name               node1,node2
>         alias                         node1
>         address                   192.168.122.167,192.168.122.218
>         }


No.  You do need separate host definitions, but you can add each host
to the same hostgroup for example by adding a directive like this to
the host definition:

  hostgroup_name   linux-group

(in fact you can add that to the host template instead if you like).

You will need to define this new hostgroup:

define hostgroup{
  hostgroup_name   linux-group
  alias                    linux-group hostgroup containing all
monitored linux servers
}


>
> define service{
>         use                             local-service         ; Name of service template to use
>         host_name                       node1,node2
>         service_description             Current Users
>     check_command            check_nrpe!check_users
>         }

In that example, you can now use the hostgroup like so:

 define service{
         use                             local-service         ; Name
of service template to use
         hostgroup_name                       linux-group
         service_description             Current Users
     check_command            check_nrpe!check_users
         }


I hope that helps a little.

------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on "Lean Startup 
Secrets Revealed." This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
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