Dzahn has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/173999

Change subject: kill facilities.pp, move to nagios_common
......................................................................

kill facilities.pp, move to nagios_common

the PDU monitoring defines and class  are moved
over into the nagios_common module

the dc-cam class is not being used and removed elsewhere

the role/icinga now includes from the new place
and in site.pp we don't need to import facilities.pp anymore
at all

Change-Id: Ib06d7943e315c07bc0dea9cb8b5ab0db50cbbcb6
---
D manifests/facilities.pp
M manifests/role/icinga.pp
M manifests/site.pp
A modules/nagios_common/manifests/monitor_pdu_3phase.pp
A modules/nagios_common/manifests/monitor_pdu_service.pp
A modules/nagios_common/manifests/pdu_monitoring.pp
6 files changed, 194 insertions(+), 200 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/99/173999/1

diff --git a/manifests/facilities.pp b/manifests/facilities.pp
deleted file mode 100644
index 77abe07..0000000
--- a/manifests/facilities.pp
+++ /dev/null
@@ -1,198 +0,0 @@
-# facilities.pp
-
-# definition for monitoring PDUs via SNMP
-# RT #308
-
-# TODO: Monitor infeed status
-
-define monitor_pdu_service(
-    $host,
-    $ip,
-    $tower,
-    $infeed,
-    $breaker  = '30',
-    $redundant= true
-) {
-
-    include passwords::nagios::snmp
-
-    $servertech_tree = '.1.3.6.1.4.1.1718'
-    $infeedLoad      = '.3.2.2.1.7'
-    $oid = "${servertech_tree}${infeedLoad}.${tower}.${infeed}"
-
-    # The value of infeedLoadValue is given in _hundredths of Amps_,
-    # thats why we multiply here
-
-    if $redundant == false {
-        $warn_hi = $breaker * 0.8 * 100
-        $crit_hi = $breaker * 0.85 * 100
-    } else {
-        $warn_hi = $breaker * 0.4 * 100
-        $crit_hi = $breaker * 0.8 * 100
-    }
-
-    @monitoring::service { $title:
-        host          => $host,
-        group         => 'pdus',
-        description   => $title,
-        check_command => 
"check_snmp_generic!${passwords::nagios::snmp::pdu_snmp_pass}!${oid}!${title}!${warn_hi}!${crit_hi}",
-    }
-
-}
-
-define monitor_pdu_3phase(
-    $ip,
-    $breaker  = '30',
-    $redundant= true
-) {
-    @monitoring::host { $title:
-        ip_address => $ip,
-        group      => 'pdus',
-    }
-
-    monitor_pdu_service { "${title}-infeed-load-tower-A-phase-X":
-        host      => $title,
-        ip        => $ip,
-        tower     => '1',
-        infeed    => '1',
-        breaker   => $breaker,
-        redundant => $redundant,
-    }
-
-    monitor_pdu_service { "${title}-infeed-load-tower-A-phase-Y":
-        host      => $title,
-        ip        => $ip,
-        tower     => '1',
-        infeed    => '2',
-        breaker   => $breaker,
-        redundant => $redundant,
-    }
-    monitor_pdu_service { "${title}-infeed-load-tower-A-phase-Z":
-        host      => $title,
-        ip        => $ip,
-        tower     => '1',
-        infeed    => '3',
-        breaker   => $breaker,
-        redundant => $redundant,
-    }
-
-    if $redundant == true {
-        monitor_pdu_service { "${title}-infeed-load-tower-B-phase-X":
-            host      => $title,
-            ip        => $ip,
-            tower     => '2',
-            infeed    => '1',
-            breaker   => $breaker,
-            redundant => $redundant,
-        }
-        monitor_pdu_service { "${title}-infeed-load-tower-B-phase-Y":
-            host      => $title,
-            ip        => $ip,
-            tower     => '2',
-            infeed    => '2',
-            breaker   => $breaker,
-            redundant => $redundant,
-        }
-        monitor_pdu_service { "${title}-infeed-load-tower-B-phase-Z":
-            host      => $title,
-            ip        => $ip,
-            tower     => '2',
-            infeed    => '3',
-            breaker   => $breaker,
-            redundant => $redundant,
-        }
-    }
-}
-
-# Nagios monitoring
-@monitoring::group { 'pdus':
-    description => 'PDUs',
-}
-
-
-class facilities::pdu_monitoring {
-
-    # The PDUs are queried over SNMP using the snmp command provided by the 
snmp
-    # package. For now ensure it here but it may need to be put in another 
place
-    # in the future
-    package { 'snmp':
-        ensure => installed,
-    }
-    # eqiad
-    # A
-    monitor_pdu_3phase { 'ps1-a1-eqiad':
-        ip => '10.65.0.32',
-    }
-    monitor_pdu_3phase { 'ps1-a2-eqiad':
-        ip => '10.65.0.33',
-    }
-    monitor_pdu_3phase { 'ps1-a3-eqiad':
-        ip => '10.65.0.34',
-    }
-    monitor_pdu_3phase { 'ps1-a4-eqiad':
-        ip => '10.65.0.35',
-    }
-    monitor_pdu_3phase { 'ps1-a5-eqiad':
-        ip => '10.65.0.36',
-    }
-    monitor_pdu_3phase { 'ps1-a6-eqiad':
-        ip => '10.65.0.37',
-    }
-    monitor_pdu_3phase { 'ps1-a7-eqiad':
-        ip => '10.65.0.38',
-    }
-    monitor_pdu_3phase { 'ps1-a8-eqiad':
-        ip => '10.65.0.39',
-    }
-    # B
-    monitor_pdu_3phase { 'ps1-b1-eqiad':
-        ip => '10.65.0.40',
-    }
-    monitor_pdu_3phase { 'ps1-b2-eqiad':
-        ip => '10.65.0.41',
-    }
-    monitor_pdu_3phase { 'ps1-b3-eqiad':
-        ip => '10.65.0.42',
-    }
-    monitor_pdu_3phase { 'ps1-b4-eqiad':
-        ip => '10.65.0.43',
-    }
-    monitor_pdu_3phase { 'ps1-b5-eqiad':
-        ip => '10.65.0.44',
-    }
-    monitor_pdu_3phase { 'ps1-b6-eqiad':
-        ip => '10.65.0.45',
-    }
-    monitor_pdu_3phase { 'ps1-b7-eqiad':
-        ip => '10.65.0.46',
-    }
-    monitor_pdu_3phase { 'ps1-b8-eqiad':
-        ip => '10.65.0.47',
-    }
-    # C
-    monitor_pdu_3phase { 'ps1-c1-eqiad':
-        ip => '10.65.0.48',
-    }
-    monitor_pdu_3phase { 'ps1-c2-eqiad':
-        ip => '10.65.0.49',
-    }
-    monitor_pdu_3phase { 'ps1-c3-eqiad':
-        ip => '10.65.0.50',
-    }
-    monitor_pdu_3phase { 'ps1-c4-eqiad':
-        ip => '10.65.0.51',
-    }
-    monitor_pdu_3phase { 'ps1-c5-eqiad':
-        ip => '10.65.0.52',
-    }
-    monitor_pdu_3phase { 'ps1-c6-eqiad':
-        ip => '10.65.0.53',
-    }
-    monitor_pdu_3phase { 'ps1-c7-eqiad':
-        ip => '10.65.0.54',
-    }
-    monitor_pdu_3phase { 'ps1-c8-eqiad':
-        ip => '10.65.0.55',
-    }
-}
-
diff --git a/manifests/role/icinga.pp b/manifests/role/icinga.pp
index abd5560..962a5d8 100644
--- a/manifests/role/icinga.pp
+++ b/manifests/role/icinga.pp
@@ -11,7 +11,7 @@
 class role::icinga(
     $ircbot = true,
 ){
-    include facilities::pdu_monitoring
+    include nagios_common::pdu_monitoring
     include icinga::monitor::checkpaging
     include icinga::nsca::firewall
     include icinga::nsca::daemon
diff --git a/manifests/site.pp b/manifests/site.pp
index 0a29a63..04fb243 100644
--- a/manifests/site.pp
+++ b/manifests/site.pp
@@ -4,7 +4,6 @@
 import 'realm.pp' # These ones first
 import 'certs.pp'
 import 'dns.pp'
-import 'facilities.pp'
 import 'ganglia.pp'
 import 'iptables.pp'
 import 'mail.pp'
diff --git a/modules/nagios_common/manifests/monitor_pdu_3phase.pp 
b/modules/nagios_common/manifests/monitor_pdu_3phase.pp
new file mode 100644
index 0000000..364e084
--- /dev/null
+++ b/modules/nagios_common/manifests/monitor_pdu_3phase.pp
@@ -0,0 +1,64 @@
+define nagios_common::monitor_pdu_3phase(
+    $ip,
+    $breaker  = '30',
+    $redundant= true
+) {
+    @monitoring::host { $title:
+        ip_address => $ip,
+        group      => 'pdus',
+    }
+
+    monitor_pdu_service { "${title}-infeed-load-tower-A-phase-X":
+        host      => $title,
+        ip        => $ip,
+        tower     => '1',
+        infeed    => '1',
+        breaker   => $breaker,
+        redundant => $redundant,
+    }
+
+    monitor_pdu_service { "${title}-infeed-load-tower-A-phase-Y":
+        host      => $title,
+        ip        => $ip,
+        tower     => '1',
+        infeed    => '2',
+        breaker   => $breaker,
+        redundant => $redundant,
+    }
+    monitor_pdu_service { "${title}-infeed-load-tower-A-phase-Z":
+        host      => $title,
+        ip        => $ip,
+        tower     => '1',
+        infeed    => '3',
+        breaker   => $breaker,
+        redundant => $redundant,
+    }
+
+    if $redundant == true {
+        monitor_pdu_service { "${title}-infeed-load-tower-B-phase-X":
+            host      => $title,
+            ip        => $ip,
+            tower     => '2',
+            infeed    => '1',
+            breaker   => $breaker,
+            redundant => $redundant,
+        }
+        monitor_pdu_service { "${title}-infeed-load-tower-B-phase-Y":
+            host      => $title,
+            ip        => $ip,
+            tower     => '2',
+            infeed    => '2',
+            breaker   => $breaker,
+            redundant => $redundant,
+        }
+        monitor_pdu_service { "${title}-infeed-load-tower-B-phase-Z":
+            host      => $title,
+            ip        => $ip,
+            tower     => '2',
+            infeed    => '3',
+            breaker   => $breaker,
+            redundant => $redundant,
+        }
+    }
+}
+
diff --git a/modules/nagios_common/manifests/monitor_pdu_service.pp 
b/modules/nagios_common/manifests/monitor_pdu_service.pp
new file mode 100644
index 0000000..866d2ff
--- /dev/null
+++ b/modules/nagios_common/manifests/monitor_pdu_service.pp
@@ -0,0 +1,39 @@
+# formerly facilities.pp
+# definition for monitoring PDUs via SNMP
+# RT #308
+# TODO: Monitor infeed status
+define nagios_common::monitor_pdu_service(
+    $host,
+    $ip,
+    $tower,
+    $infeed,
+    $breaker  = '30',
+    $redundant= true
+) {
+
+    include passwords::nagios::snmp
+
+    $servertech_tree = '.1.3.6.1.4.1.1718'
+    $infeedLoad      = '.3.2.2.1.7'
+    $oid = "${servertech_tree}${infeedLoad}.${tower}.${infeed}"
+
+    # The value of infeedLoadValue is given in _hundredths of Amps_,
+    # thats why we multiply here
+
+    if $redundant == false {
+        $warn_hi = $breaker * 0.8 * 100
+        $crit_hi = $breaker * 0.85 * 100
+    } else {
+        $warn_hi = $breaker * 0.4 * 100
+        $crit_hi = $breaker * 0.8 * 100
+    }
+
+    @monitor_service { $title:
+        host          => $host,
+        group         => 'pdus',
+        description   => $title,
+        check_command => 
"check_snmp_generic!${passwords::nagios::snmp::pdu_snmp_pass}!${oid}!${title}!${warn_hi}!${crit_hi}",
+    }
+
+}
+
diff --git a/modules/nagios_common/manifests/pdu_monitoring.pp 
b/modules/nagios_common/manifests/pdu_monitoring.pp
new file mode 100644
index 0000000..a9b7de3
--- /dev/null
+++ b/modules/nagios_common/manifests/pdu_monitoring.pp
@@ -0,0 +1,90 @@
+class nagios_common::pdu_monitoring {
+
+    @monitoring::group { 'pdus':
+        description => 'PDUs',
+    }
+
+    # The PDUs are queried over SNMP using the snmp command provided by the 
snmp
+    # package. For now ensure it here but it may need to be put in another 
place
+    # in the future
+    package { 'snmp':
+        ensure => installed,
+    }
+    # eqiad
+    # A
+    nagios_common::monitor_pdu_3phase { 'ps1-a1-eqiad':
+        ip => '10.65.0.32',
+    }
+    nagios_common::monitor_pdu_3phase { 'ps1-a2-eqiad':
+        ip => '10.65.0.33',
+    }
+    nagios_common::monitor_pdu_3phase { 'ps1-a3-eqiad':
+        ip => '10.65.0.34',
+    }
+    nagios_common::monitor_pdu_3phase { 'ps1-a4-eqiad':
+        ip => '10.65.0.35',
+    }
+    nagios_common::monitor_pdu_3phase { 'ps1-a5-eqiad':
+        ip => '10.65.0.36',
+    }
+    nagios_common::monitor_pdu_3phase { 'ps1-a6-eqiad':
+        ip => '10.65.0.37',
+    }
+    nagios_common::monitor_pdu_3phase { 'ps1-a7-eqiad':
+        ip => '10.65.0.38',
+    }
+    nagios_common::monitor_pdu_3phase { 'ps1-a8-eqiad':
+        ip => '10.65.0.39',
+    }
+    # B
+    nagios_common::monitor_pdu_3phase { 'ps1-b1-eqiad':
+        ip => '10.65.0.40',
+    }
+    nagios_common::monitor_pdu_3phase { 'ps1-b2-eqiad':
+        ip => '10.65.0.41',
+    }
+    nagios_common::monitor_pdu_3phase { 'ps1-b3-eqiad':
+        ip => '10.65.0.42',
+    }
+    nagios_common::monitor_pdu_3phase { 'ps1-b4-eqiad':
+        ip => '10.65.0.43',
+    }
+    nagios_common::monitor_pdu_3phase { 'ps1-b5-eqiad':
+        ip => '10.65.0.44',
+    }
+    nagios_common::monitor_pdu_3phase { 'ps1-b6-eqiad':
+        ip => '10.65.0.45',
+    }
+    nagios_common::monitor_pdu_3phase { 'ps1-b7-eqiad':
+        ip => '10.65.0.46',
+    }
+    nagios_common::monitor_pdu_3phase { 'ps1-b8-eqiad':
+        ip => '10.65.0.47',
+    }
+    # C
+    nagios_common::monitor_pdu_3phase { 'ps1-c1-eqiad':
+        ip => '10.65.0.48',
+    }
+    nagios_common::monitor_pdu_3phase { 'ps1-c2-eqiad':
+        ip => '10.65.0.49',
+    }
+    nagios_common::monitor_pdu_3phase { 'ps1-c3-eqiad':
+        ip => '10.65.0.50',
+    }
+    nagios_common::monitor_pdu_3phase { 'ps1-c4-eqiad':
+        ip => '10.65.0.51',
+    }
+    nagios_common::monitor_pdu_3phase { 'ps1-c5-eqiad':
+        ip => '10.65.0.52',
+    }
+    nagios_common::monitor_pdu_3phase { 'ps1-c6-eqiad':
+        ip => '10.65.0.53',
+    }
+    nagios_common::monitor_pdu_3phase { 'ps1-c7-eqiad':
+        ip => '10.65.0.54',
+    }
+    nagios_common::monitor_pdu_3phase { 'ps1-c8-eqiad':
+        ip => '10.65.0.55',
+    }
+}
+

-- 
To view, visit https://gerrit.wikimedia.org/r/173999
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib06d7943e315c07bc0dea9cb8b5ab0db50cbbcb6
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Dzahn <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to