Yuvipanda has submitted this change and it was merged.

Change subject: facilities: move to module
......................................................................


facilities: move to module

after the dc-cam class has been removed
facilities.pp is just PDU monitoring

first attempt was Ib06d7943e315c0 to move this
to nagios_common module, but per comments from Yuvi,
abandoned that and now creating a new module
'facilities' instead and moving it there

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

Approvals:
  Yuvipanda: Looks good to me, approved
  Alexandros Kosiaris: Looks good to me, but someone else must approve
  jenkins-bot: Verified



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..73221d3 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 facilities
     include icinga::monitor::checkpaging
     include icinga::nsca::firewall
     include icinga::nsca::daemon
diff --git a/manifests/site.pp b/manifests/site.pp
index 37c356a..688fa18 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/facilities/manifests/init.pp 
b/modules/facilities/manifests/init.pp
new file mode 100644
index 0000000..efa30f7
--- /dev/null
+++ b/modules/facilities/manifests/init.pp
@@ -0,0 +1,93 @@
+# monitoring of non-server data center
+# hardware like power distribution units and cameras
+class facilities {
+
+    @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
+    facilities::monitor_pdu_3phase { 'ps1-a1-eqiad':
+        ip => '10.65.0.32',
+    }
+    facilities::monitor_pdu_3phase { 'ps1-a2-eqiad':
+        ip => '10.65.0.33',
+    }
+    facilities::monitor_pdu_3phase { 'ps1-a3-eqiad':
+        ip => '10.65.0.34',
+    }
+    facilities::monitor_pdu_3phase { 'ps1-a4-eqiad':
+        ip => '10.65.0.35',
+    }
+    facilities::monitor_pdu_3phase { 'ps1-a5-eqiad':
+        ip => '10.65.0.36',
+    }
+    facilities::monitor_pdu_3phase { 'ps1-a6-eqiad':
+        ip => '10.65.0.37',
+    }
+    facilities::monitor_pdu_3phase { 'ps1-a7-eqiad':
+        ip => '10.65.0.38',
+    }
+    facilities::monitor_pdu_3phase { 'ps1-a8-eqiad':
+        ip => '10.65.0.39',
+    }
+    # B
+    facilities::monitor_pdu_3phase { 'ps1-b1-eqiad':
+        ip => '10.65.0.40',
+    }
+    facilities::monitor_pdu_3phase { 'ps1-b2-eqiad':
+        ip => '10.65.0.41',
+    }
+    facilities::monitor_pdu_3phase { 'ps1-b3-eqiad':
+        ip => '10.65.0.42',
+    }
+    facilities::monitor_pdu_3phase { 'ps1-b4-eqiad':
+        ip => '10.65.0.43',
+    }
+    facilities::monitor_pdu_3phase { 'ps1-b5-eqiad':
+        ip => '10.65.0.44',
+    }
+    facilities::monitor_pdu_3phase { 'ps1-b6-eqiad':
+        ip => '10.65.0.45',
+    }
+    facilities::monitor_pdu_3phase { 'ps1-b7-eqiad':
+        ip => '10.65.0.46',
+    }
+    facilities::monitor_pdu_3phase { 'ps1-b8-eqiad':
+        ip => '10.65.0.47',
+    }
+    # C
+    facilities::monitor_pdu_3phase { 'ps1-c1-eqiad':
+        ip => '10.65.0.48',
+    }
+    facilities::monitor_pdu_3phase { 'ps1-c2-eqiad':
+        ip => '10.65.0.49',
+    }
+    facilities::monitor_pdu_3phase { 'ps1-c3-eqiad':
+        ip => '10.65.0.50',
+    }
+    facilities::monitor_pdu_3phase { 'ps1-c4-eqiad':
+        ip => '10.65.0.51',
+    }
+    facilities::monitor_pdu_3phase { 'ps1-c5-eqiad':
+        ip => '10.65.0.52',
+    }
+    facilities::monitor_pdu_3phase { 'ps1-c6-eqiad':
+        ip => '10.65.0.53',
+    }
+    facilities::monitor_pdu_3phase { 'ps1-c7-eqiad':
+        ip => '10.65.0.54',
+    }
+    facilities::monitor_pdu_3phase { 'ps1-c8-eqiad':
+        ip => '10.65.0.55',
+    }
+}
+
diff --git a/modules/facilities/manifests/monitor_pdu_3phase.pp 
b/modules/facilities/manifests/monitor_pdu_3phase.pp
new file mode 100644
index 0000000..64fe0c2
--- /dev/null
+++ b/modules/facilities/manifests/monitor_pdu_3phase.pp
@@ -0,0 +1,64 @@
+define facilities::monitor_pdu_3phase(
+    $ip,
+    $breaker  = '30',
+    $redundant= true
+) {
+    @monitoring::host { $title:
+        ip_address => $ip,
+        group      => 'pdus',
+    }
+
+    facilities::monitor_pdu_service { "${title}-infeed-load-tower-A-phase-X":
+        host      => $title,
+        ip        => $ip,
+        tower     => '1',
+        infeed    => '1',
+        breaker   => $breaker,
+        redundant => $redundant,
+    }
+
+    facilities::monitor_pdu_service { "${title}-infeed-load-tower-A-phase-Y":
+        host      => $title,
+        ip        => $ip,
+        tower     => '1',
+        infeed    => '2',
+        breaker   => $breaker,
+        redundant => $redundant,
+    }
+    facilities::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 {
+        facilities::monitor_pdu_service { 
"${title}-infeed-load-tower-B-phase-X":
+            host      => $title,
+            ip        => $ip,
+            tower     => '2',
+            infeed    => '1',
+            breaker   => $breaker,
+            redundant => $redundant,
+        }
+        facilities::monitor_pdu_service { 
"${title}-infeed-load-tower-B-phase-Y":
+            host      => $title,
+            ip        => $ip,
+            tower     => '2',
+            infeed    => '2',
+            breaker   => $breaker,
+            redundant => $redundant,
+        }
+        facilities::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/facilities/manifests/monitor_pdu_service.pp 
b/modules/facilities/manifests/monitor_pdu_service.pp
new file mode 100644
index 0000000..58eb42e
--- /dev/null
+++ b/modules/facilities/manifests/monitor_pdu_service.pp
@@ -0,0 +1,38 @@
+# definition for monitoring PDUs via SNMP
+# RT #308
+# TODO: Monitor infeed status
+define facilities::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}",
+    }
+
+}
+

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia41e114465b61eb9d6d6402a58131a4598f7eab2
Gerrit-PatchSet: 5
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Dzahn <[email protected]>
Gerrit-Reviewer: Alexandros Kosiaris <[email protected]>
Gerrit-Reviewer: Giuseppe Lavagetto <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: Yuvipanda <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to