need expert advice/suggestions

Morris, Patrick patrick.morris at hp.com
Tue Dec 8 18:44:41 CET 2009


gmartin wrote:
>
>
> On Mon, Dec 7, 2009 at 4:29 PM, <patrick.morris at hp.com 
> <mailto:patrick.morris at hp.com>> wrote:
>
>     Hi Taylor!
>
>     For what it's worth, Nagios *does* support this.  We routinely use
>     templates which assign a hostgroup to a host, and that hostgroup will
>     have a set of standard check for that type of host assigned to it.
>      When
>     a new host gets added, all it takes is a "use some_host_template" and
>     all the standard services we run on that type of host just show up.
>
>
> Patrick, can you explain this a bit further or point me towards 
> another post that does the same.  Sounds like an interesting feature I 
> want to explore.

Sure. Here's an example off the top of my head:

# Generic template to base other types of host on.
# Sets up some baseline defaults for all hosts
define host {
        name                            generic-host
        notifications_enabled           1
        event_handler_enabled           1
        flap_detection_enabled          1
        process_perf_data               1
        retain_status_information       1
        retain_nonstatus_information    1
        obsess_over_host                1
        check_command                   check_host_alive
        check_interval                  0
        check_freshness                 0
        max_check_attempts              10
        notification_interval           15
        notification_period             24x7
        notification_options            d,u,r,f,s
}

# Linux hosts use this template
define host {
        name                            linux-host
        hostgroups                      +systems,linux_servers
        use                             generic-host
        contact_groups                  sysadm,sysadm-oncall
}

#Windows hosts use this template
define host {
        name                            windows-host
        hostgroups                      +systems,windows_servers
        use                             generic-host
        contact_groups                  winadm,winadm_oncall
}

# Check SSH on Linux hosts
define service {
        use                             generic_service
        hostgroup_name                  linux_servers
        service_description             SSH
        contact_groups                  sysadm,sysadm_oncall
        check_command                   check_trap
}

# Check telnet on Windows hosts (bad example, but if we ran telnet on 
Windows, this would work)
define service {
        use                             generic_service
        hostgroup_name                  windows_servers
        service_description             TELNET
        contact_groups                  winadm,winadm_oncall
        check_command                   check_telnet
}

# Check for SNMP traps on all hosts
define service {
        use                             generic_service
        hostgroup_name                  systems
        service_description             TRAP
        contact_groups                  sysadm,sysadm_oncall
        check_command                   check_trap
}

define host {
  host_name       mylinuxhost
  use             linux-host
  address         mylinuxhost.example.com
}

define host {
  host_name       mywindowshost
  use             windows-host
  address         mywindowshost.example.com
}

Note that the last two definitions are the only "real" ones. Those set 
up two hosts: one Linux, one Windows. Since they're defined using the 
templates set up earlier, they get the checks appropriate to their host 
type (SSH for Linux, Telnet for Windows), and all hosts get the "TRAP" 
check assigned to them.

Our real configs here are much more complex and use a larger number of 
hostgroups, but basically we've set up templates for each hardware/OS 
combination we use, so that a standard set of checks ends up applied to, 
say, all of our C-class blade servers that run Red Hat Linux, while a 
different set of checks gets assigned to DL380 Windows servers, and 
still other checks get assigned to Cisco 6000-series routers running IOS.

We then assign hostgroups at the host level for any applications that 
need monitoring. We *could* do that with templates, too, but made a 
design decision to use the templates for the hardware/OS-level checks, 
and to assign to app-level stuff on the hosts.

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
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