Faidon Liambotis has uploaded a new change for review.

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

Change subject: Create raid module to hold RAID monitoring checks
......................................................................

Create raid module to hold RAID monitoring checks

Move check-raid.py and associated packages and definitions away from
base::monitoring::host and into a new "raid" class, init class of the
new "raid" module. Not much win so far, more will follow.

Bug: T84050
Change-Id: Ifb3e9dd0ed78cf6fa7b37f576ae0302c668e966a
---
M modules/base/manifests/monitoring/host.pp
M modules/nagios_common/files/checkcommands.cfg
R modules/raid/files/check-raid.py
A modules/raid/manifests/init.pp
4 files changed, 48 insertions(+), 33 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/86/290986/1

diff --git a/modules/base/manifests/monitoring/host.pp 
b/modules/base/manifests/monitoring/host.pp
index 752235c..bb68963 100644
--- a/modules/base/manifests/monitoring/host.pp
+++ b/modules/base/manifests/monitoring/host.pp
@@ -30,6 +30,9 @@
 ) {
     include base::puppet::params # In order to be able to use some variables
 
+    # RAID checks
+    include raid
+
     monitoring::host { $::hostname: }
 
     monitoring::service { 'ssh':
@@ -37,26 +40,6 @@
         check_command => 'check_ssh',
     }
 
-    package { [ 'megacli', 'arcconf', 'mpt-status' ]:
-        ensure => 'latest',
-    }
-
-    file { '/etc/default/mpt-statusd':
-        ensure  => present,
-        owner   => 'root',
-        group   => 'root',
-        mode    => '0555',
-        content => "RUN_DAEMON=no\n",
-        before  => Package['mpt-status'],
-    }
-
-    file { '/usr/local/bin/check-raid.py':
-        ensure => present,
-        owner  => 'root',
-        group  => 'root',
-        mode   => '0555',
-        source => 'puppet:///modules/base/monitoring/check-raid.py';
-    }
     file { '/usr/local/lib/nagios/plugins/check_puppetrun':
         ensure => present,
         owner  => 'root',
@@ -87,15 +70,9 @@
         source => 
'puppet:///modules/base/monitoring/check-fresh-files-in-dir.py',
     }
 
-    sudo::user { 'nagios':
-        privileges   => [
-                        'ALL = NOPASSWD: /usr/local/bin/check-raid.py',
-                        'ALL = NOPASSWD: 
/usr/local/lib/nagios/plugins/check_puppetrun',
-                        ],
-    }
-    nrpe::monitor_service { 'raid':
-        description  => 'RAID',
-        nrpe_command => '/usr/bin/sudo /usr/local/bin/check-raid.py',
+    sudo::user { 'nagios_puppetrun':
+        user       => 'nagios',
+        privileges  => ['ALL = NOPASSWD: 
/usr/local/lib/nagios/plugins/check_puppetrun'],
     }
 
     # Check for disk usage on the root partition for labs instances
diff --git a/modules/nagios_common/files/checkcommands.cfg 
b/modules/nagios_common/files/checkcommands.cfg
index 8c014fa..ceb56d3 100644
--- a/modules/nagios_common/files/checkcommands.cfg
+++ b/modules/nagios_common/files/checkcommands.cfg
@@ -324,10 +324,6 @@
     }
 
 define command {
-    command_name    nrpe_check_raid
-    command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_raid
-    }
-define command {
     command_name    check_ircd
     command_line    $USER1$/check_ircd -H $HOSTADDRESS$ -w 800 -c 1000
 }
diff --git a/modules/base/files/monitoring/check-raid.py 
b/modules/raid/files/check-raid.py
similarity index 100%
rename from modules/base/files/monitoring/check-raid.py
rename to modules/raid/files/check-raid.py
diff --git a/modules/raid/manifests/init.pp b/modules/raid/manifests/init.pp
new file mode 100644
index 0000000..e9f9509
--- /dev/null
+++ b/modules/raid/manifests/init.pp
@@ -0,0 +1,42 @@
+# == Class: raid
+#
+# Class to set up monitoring for software and hardware RAID
+#
+# === Parameters
+#
+# === Examples
+#
+#  include raid
+
+class raid {
+    package { [ 'megacli', 'arcconf', 'mpt-status' ]:
+        ensure => 'latest',
+    }
+
+    file { '/etc/default/mpt-statusd':
+        ensure  => present,
+        owner   => 'root',
+        group   => 'root',
+        mode    => '0555',
+        content => "RUN_DAEMON=no\n",
+        before  => Package['mpt-status'],
+    }
+
+    file { '/usr/local/bin/check-raid.py':
+        ensure => present,
+        owner  => 'root',
+        group  => 'root',
+        mode   => '0555',
+        source => 'puppet:///modules/raid/check-raid.py';
+    }
+
+    sudo::user { 'nagios_raid':
+        user       => 'nagios',
+        privileges => ['ALL = NOPASSWD: /usr/local/bin/check-raid.py'],
+    }
+
+    nrpe::monitor_service { 'raid':
+        description  => 'RAID',
+        nrpe_command => '/usr/bin/sudo /usr/local/bin/check-raid.py',
+    }
+}

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

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

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

Reply via email to