[debian-lan-devel] [debian-lan] 01/05: Do not send notifications for host that are switched on and off.

Andreas B. Mundt andi at moszumanska.debian.org
Fri Apr 4 15:46:16 UTC 2014


This is an automated email from the git hooks/post-receive script.

andi pushed a commit to branch wheezy
in repository debian-lan.

commit f3c17da130989a07704c15a67a916be57d51478b
Author: Andreas B. Mundt <andi at debian.org>
Date:   Thu Mar 20 23:10:54 2014 +0100

    Do not send notifications for host that are switched on and off.
    
    This should reduce the amount of email notifications sent by icinga.
    
    (cherry picked from commit ec7995817c8f6faaceabfc8d67818787ac23b650)
---
 .../objects/hostgroups_icinga.cfg/LOG_SERVER       |  7 +++++-
 .../files/etc/icinga/objects/hosts.cfg/LOG_SERVER  |  3 +--
 .../icinga/objects/services_icinga.cfg/LOG_SERVER  | 25 ++++++++++++++--------
 .../files/usr/local/sbin/debian-lan/SERVER_A       |  5 ++---
 fai/config/scripts/LOG_SERVER/10-rsyslog_icinga    |  7 ++++++
 5 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/fai/config/files/etc/icinga/objects/hostgroups_icinga.cfg/LOG_SERVER b/fai/config/files/etc/icinga/objects/hostgroups_icinga.cfg/LOG_SERVER
index d6e1a43..6dc8c1b 100644
--- a/fai/config/files/etc/icinga/objects/hostgroups_icinga.cfg/LOG_SERVER
+++ b/fai/config/files/etc/icinga/objects/hostgroups_icinga.cfg/LOG_SERVER
@@ -16,7 +16,6 @@ define hostgroup {
        hostgroup_name    ssh-servers
        alias             SSH servers
        members           mainserver
-       hostgroup_members workstation
 }
 
 define hostgroup {
@@ -71,3 +70,9 @@ define hostgroup {
        hostgroup_name    diskless
        alias             Debian GNU/Linux Diskless
 }
+
+define hostgroup {
+       hostgroup_name    client-ssh-servers
+       alias             Client SSH servers
+       hostgroup_members workstation
+}
diff --git a/fai/config/files/etc/icinga/objects/hosts.cfg/LOG_SERVER b/fai/config/files/etc/icinga/objects/hosts.cfg/LOG_SERVER
index 93e70b7..066d61b 100644
--- a/fai/config/files/etc/icinga/objects/hosts.cfg/LOG_SERVER
+++ b/fai/config/files/etc/icinga/objects/hosts.cfg/LOG_SERVER
@@ -11,8 +11,7 @@ define host{
 }
 
 define host{
-        use                    generic-host
+        use                    client-host
         host_name              workstation00
         hostgroups             workstation
-        notifications_enabled  0
 }
diff --git a/fai/config/files/etc/icinga/objects/services_icinga.cfg/LOG_SERVER b/fai/config/files/etc/icinga/objects/services_icinga.cfg/LOG_SERVER
index 4a8836b..7248c0a 100644
--- a/fai/config/files/etc/icinga/objects/services_icinga.cfg/LOG_SERVER
+++ b/fai/config/files/etc/icinga/objects/services_icinga.cfg/LOG_SERVER
@@ -143,65 +143,72 @@ define service{
 
 
 #### nrpe (remote) machines
+define service {
+        hostgroup_name         client-ssh-servers
+        service_description    SSH
+        check_command          check_ssh
+        use                    client-service
+}
+
 define service{
         hostgroup_name         workstation
         service_description    APT
         check_command          check_nrpe_1arg!check_apt
-        use                    generic-service
+        use                    client-service
 }
 
 define service{
         hostgroup_name         workstation,diskless
         service_description    Current Load
         check_command          check_nrpe_1arg!debian-lan_check_load
-        use                    generic-service
+        use                    client-service
 }
 
 define service{
         hostgroup_name         workstation,diskless
         service_description    Current Users
         check_command          check_nrpe_1arg!debian-lan_check_users
-        use                    generic-service
+        use                    client-service
 }
 
 define service{
         hostgroup_name         workstation
         service_description    Disk Space
         check_command          check_nrpe_1arg!debian-lan_check_all_disks
-        use                    generic-service
+        use                    client-service
 }
 
 define service{
         hostgroup_name         workstation
         service_description    Kerberos Key
         check_command          check_nrpe_1arg!debian-lan_check_file_age
-        use                    generic-service
+        use                    client-service
 }
 
 define service{
         hostgroup_name         workstation,diskless
         service_description    Swap
         check_command          check_nrpe_1arg!debian-lan_check_swap
-        use                    generic-service
+        use                    client-service
 }
 
 define service{
         hostgroup_name         workstation,diskless
         service_description    Time
         check_command          check_nrpe_1arg!debian-lan_check_ntp_time
-        use                    generic-service
+        use                    client-service
 }
 
 define service{
         hostgroup_name         workstation,diskless
         service_description    Total Procs
         check_command          check_nrpe_1arg!debian-lan_check_procs
-        use                    generic-service
+        use                    client-service
 }
 
 define service{
         hostgroup_name         workstation,diskless
         service_description    Zombie Procs
         check_command          check_nrpe_1arg!debian-lan_check_procs_zombie
-        use                    generic-service
+        use                    client-service
 }
diff --git a/fai/config/files/usr/local/sbin/debian-lan/SERVER_A b/fai/config/files/usr/local/sbin/debian-lan/SERVER_A
index 0edf4cf..4a5c2e4 100755
--- a/fai/config/files/usr/local/sbin/debian-lan/SERVER_A
+++ b/fai/config/files/usr/local/sbin/debian-lan/SERVER_A
@@ -107,13 +107,12 @@ EOF
     CONF='/etc/icinga/objects/hosts.cfg'
     if ! grep -sq ${MACHINE} $CONF ; then
         cat >> $CONF <<EOF
+
 define host{
-        use                    generic-host
+        use                    client-host
         host_name              ${MACHINE}
         hostgroups             ${MACHINE%%[0-9]*}
-        notifications_enabled  0
 }
-
 EOF
         echo "${MACHINE} will be monitored by icinga from now on. "
     else
diff --git a/fai/config/scripts/LOG_SERVER/10-rsyslog_icinga b/fai/config/scripts/LOG_SERVER/10-rsyslog_icinga
index 27dbe82..5b5e95b 100755
--- a/fai/config/scripts/LOG_SERVER/10-rsyslog_icinga
+++ b/fai/config/scripts/LOG_SERVER/10-rsyslog_icinga
@@ -15,4 +15,11 @@ if [ "$FAI_ACTION" == "install" ] || [ "$CONVERT" == "true" ] ; then
     fcopy /etc/icinga/objects/hosts.cfg
     sed -i "s#\$GATEWAY#$GATEWAY#" $target/etc/icinga/objects/hosts.cfg
     mv $target/etc/icinga/objects/localhost_icinga.cfg $target/etc/icinga/objects/localhost_icinga.cfg_orig || true
+    ## Prepare templates with notifications disabled for the client machines:
+    sed -e "s/generic/client/" -e "s/Generic/Client/" \
+        -e "s/\(notifications_enabled[[:space:]]*\)1.*/\10       ; Host notifications are disabled/" \
+        $target/etc/icinga/objects/generic-host_icinga.cfg > $target/etc/icinga/objects/client-host_icinga.cfg
+    sed -e "s/generic/client/" -e "s/Generic/Client/" \
+        -e "s/\(notifications_enabled[[:space:]]*\)1.*/\10       ; Service notifications are disabled/" \
+        $target/etc/icinga/objects/generic-service_icinga.cfg > $target/etc/icinga/objects/client-service_icinga.cfg
 fi

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/debian-lan.git



More information about the debian-lan-devel mailing list