On Tue, 28 Apr 2009 15:37:25 -0700 (PDT), Dei Bertine
<[email protected]> wrote:

>Hi guys,
>
>I was wondering if there's a way to incorporate all hosts into one host name 
>instead of creating individual defines?
>I'm trying to add all of our servers into Nagios but there's huge amount of 
>them. 
>Need faster way to add all of them into one script. 
>Here's what I'm trying to avoid: 
>define host{
>        use                             generic-host
>        host_name                sunbl.001.csaa.net
>        alias                          UNIX-SERVER1 
>        address                     172.168.1.35
>        }
>define host{
>        use                             generic-host
>        host_name                sunbl.002.csaa.net
>        alias                          UNIX-SERVER2 
>        address                     172.168.1.36
>        }
>
>.....and so on to hundreds of define host....
>
>Here's what I'm trying to "hopefully" accomplish" if possible:
>define host{
>        use                            all-host
>        host_name               allunixhosts
>        alias                          ALL-UNIX 
>        address                     ALLIP
>        }
>
>...done all hosts...

Do you have the expectation of Nagios guessing your IP schema, and
host names?  There is a way of using nmap, and a script to build a
basis for you.

>And also have them in one "all host" services.cfg script. 
>define service{
>        use                             all-service         
>        host_name                 ALLHOSTSERVICE
>        service_description             SSH
>        check_command                   check_ssh
>        }
>
>define service{ 
>       use                             all-service
>       host_name                 ALLHOSTSERVICE
>       service_description   PING
>       check_command        check_ping
>       }

Services can be applied to hostgroups. For example:

define hostgroup {
        hostgroup_name  myunixhostgroup
}

define host {
        register                0
        name            unix_host
        hostgroups      myunixhostgroup
        [..]
}

define host {
        use             unix_host
        host_name       unix01
        address         172.16.0.2
}

define service {
        service_descript                PING
        check_command           check_ping
        hostgroup_name  myunixhostgroup
}

This reduces the definition of the host down to 3 lines, you're using
a template for all your linux hosts, and the service is applied to the
entire group.  Hope that gives you a head start.

-- 
Jonathan Angliss
<[email protected]>


------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
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