Faidon Liambotis has submitted this change and it was merged.

Change subject: raid: setup multiple checks, one per each RAID found
......................................................................


raid: setup multiple checks, one per each RAID found

Instead of calling check_raid once, and let it autodetect a single RAID
controller (or always return "OK", if none found), tie our newly-created
fact with our newly-written check-raid support for arguments to setup
multiple NRPE checks, as (or if) needed.

This also removes support for /etc/nagios/raid_utility which was used as
a workaround for systems with multiple RAID controllers, such as
labstore1001.

Bug: T84050
Change-Id: Id55187c725ec08e3c24f362729143a2182061726
---
M modules/raid/files/check-raid.py
M modules/raid/manifests/init.pp
2 files changed, 27 insertions(+), 15 deletions(-)

Approvals:
  Faidon Liambotis: Verified; Looks good to me, approved



diff --git a/modules/raid/files/check-raid.py b/modules/raid/files/check-raid.py
index 06b86b0..c03687c 100644
--- a/modules/raid/files/check-raid.py
+++ b/modules/raid/files/check-raid.py
@@ -10,14 +10,6 @@
 
 def main():
     try:
-        # following the model of self determination for OS and driver
-        # allow for a declarative override to ensure a specific driver
-        with open('/etc/nagios/raid_utility') as f:
-            hc_driver = f.read().strip()
-    except:
-        hc_driver = None
-
-    try:
         argv_driver = sys.argv[1]
     except:
         argv_driver = None
@@ -25,8 +17,6 @@
     osName = os.uname()[0]
     if argv_driver:
         driver = argv_driver
-    elif hc_driver:
-        driver = hc_driver
     elif osName == 'SunOS':
         driver = 'zpool'
     elif osName == 'Linux':
diff --git a/modules/raid/manifests/init.pp b/modules/raid/manifests/init.pp
index 5ece243..f6ff0d2 100644
--- a/modules/raid/manifests/init.pp
+++ b/modules/raid/manifests/init.pp
@@ -14,8 +14,15 @@
     # following line should be then removed.
     $raid = split($::raid, ',')
 
+    $check_raid = '/usr/bin/sudo /usr/local/lib/nagios/plugins/check_raid'
+
     if 'megaraid' in $raid {
         require_package('megacli')
+
+        nrpe::monitor_service { 'raid_megaraid':
+            description  => 'MegaRAID',
+            nrpe_command => "${check_raid} megacli",
+        }
     }
 
     if 'mpt' in $raid {
@@ -29,17 +36,37 @@
             content => "RUN_DAEMON=no\n",
             before  => Package['mpt-status'],
         }
+
+        nrpe::monitor_service { 'raid_mpt':
+            description  => 'MPT RAID',
+            nrpe_command => "${check_raid} mpt",
+        }
     }
     if 'md' in $raid {
         # if there is an "md" RAID configured, mdadm is already installed
+
+        nrpe::monitor_service { 'raid_md':
+            description  => 'MD RAID',
+            nrpe_command => "${check_raid} md",
+        }
     }
 
     if 'aac' in $raid {
         require_package('arcconf')
+
+        nrpe::monitor_service { 'raid_aac':
+            description  => 'Adaptec RAID',
+            nrpe_command => "${check_raid} aac",
+        }
     }
 
     if 'twe' in $raid {
         require_package('tw-cli')
+
+        nrpe::monitor_service { 'raid_twe':
+            description  => '3ware TW',
+            nrpe_command => "${check_raid} twe",
+        }
     }
 
     file { '/usr/local/lib/nagios/plugins/check_raid':
@@ -53,10 +80,5 @@
     sudo::user { 'nagios_raid':
         user       => 'nagios',
         privileges => ['ALL = NOPASSWD: 
/usr/local/lib/nagios/plugins/check_raid'],
-    }
-
-    nrpe::monitor_service { 'raid':
-        description  => 'RAID',
-        nrpe_command => '/usr/bin/sudo 
/usr/local/lib/nagios/plugins/check_raid',
     }
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id55187c725ec08e3c24f362729143a2182061726
Gerrit-PatchSet: 7
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Faidon Liambotis <[email protected]>
Gerrit-Reviewer: Faidon Liambotis <[email protected]>
Gerrit-Reviewer: Volans <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to