2

is it possible to set an default contact_group in hostsgroup and modify (redefine) this contact_group later in the service. Or by another way.

Background: We use nagios to monitor near 100 Hosts and near 1000 services. For easy configuration we defined hostgroups with default checks and default contactgroups. But there are more and more services on special server that must have other contactgroups.

Config-Example that shows what we want, but it doesn't work... (Last Part - Redefine)

####################
## HOST GROUP
####################

define  hostgroup{
        hostgroup_name  WINDOWS
        alias           Windows Server
}

####################
## SERVICE
####################

define service{
        use                             generic-service
        name                            RDP-CHECK-TCP-PORT
        hostgroup_name                  WINDOWS
        service_description             RDP - Check TCP Port
        check_command                   check_rdp
        contact_groups                  Admin_Alarm
}

define service{
        use                             generic-service
        name                            DF-CHECK
        hostgroup_name                  WINDOWS
        service_description             HD - Disk free
        check_command                   check_df_win
        contact_groups                  Admin_Alarm
}

####################
## HOST
####################

define host{
        use                     generic-urgent-host
        host_name               server1
        hostgroups              WINDOWS
        alias                   Server1
        address                 1.2.3.1
}

define host{
        use                     generic-urgent-host
        host_name               server2
        hostgroups              WINDOWS
        alias                   Server2
        address                 1.2.3.2
}

define host{
        use                     generic-urgent-host
        host_name               server3
        hostgroups              WINDOWS
        alias                   Server3
        address                 1.2.3.3
}

####################
## Redefine Contactgroups
####################

define service{
        host                            server1
        service_description             RDP - Check TCP Port
        contact_groups                  No_Alarm
}

define service{
        host                            server2
        service_description             RDP - Check TCP Port
        contact_groups                  Urgent_Admin_SMS_Alarm, Customer_Admin_Alarm
}
TimCgn74
  • 43
  • 2
  • 7
  • 1
    Do you have anything more than "it doesn't work" to report? Maybe I don't understand exactly what you're asking, but this conf looks fine. – Keith Sep 26 '12 at 16:41
  • See: [Service Escalation Definition](http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html#serviceescalation) and [Host Escalation Definition](http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html#hostescalation) – kenorb Apr 28 '15 at 13:12

2 Answers2

2

contact_groups can only assigned to hosts, not hostgroups. However you could use templates and put contact_groups into that templates. Later you can override the contact_groups in your host definition. Have a look at the objectinheritance docs.

sni
  • 125
  • 6
2

Since this hasn't been said:

There are tools that let you express that as rules and have simple overrides to the default settings. An escalation should rather be used for something like "I want this to immediately be visible and written to our xmpp chatroom as a notification. But if it stays for 30 minutes broken, we also wanna email the manager so he knows we have a noteworthy outage".

As for tools, I'll recommend Check_MK, which is around since 2009. Initially, it was primed for this task. These days it does a lot more.

Disclaimer: I contributed to it, since I think it is a good thing.

Florian Heigl
  • 126
  • 1
  • 8