Akosiaris has submitted this change and it was merged.

Change subject: Adding mptsas support in check-raids
......................................................................


Adding mptsas support in check-raids

Installing mpt-status, ensuring the mpt-statusd daemon is disabled and
updating check-raid to use mpt-status command to notify about RAID
failures.

Change-Id: I4468bd331c84322b229129e5f73b0610005e33ac
---
M modules/base/files/monitoring/check-raid.py
M modules/base/manifests/monitoring/host.pp
2 files changed, 48 insertions(+), 1 deletion(-)

Approvals:
  Akosiaris: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/base/files/monitoring/check-raid.py 
b/modules/base/files/monitoring/check-raid.py
index d09170d..e73f622 100644
--- a/modules/base/files/monitoring/check-raid.py
+++ b/modules/base/files/monitoring/check-raid.py
@@ -34,6 +34,8 @@
             status = checkMegaSas()
         elif utility == 'zpool':
             status = checkZfs()
+        elif utility == 'mptsas':
+            status = checkmptsas()
         elif utility == 'mdadm':
             status = checkSoftwareRaid()
         else:
@@ -75,6 +77,12 @@
     if utility is not None:
         return utility
 
+    try:
+        f = open("/proc/scsi/mptsas/0", "r")
+        return "mptsas"
+    except IOError:
+        pass
+
     # Try mdadm
     devices = getSoftwareRaidDevices()
     if len(devices):
@@ -104,6 +112,40 @@
     return devices
 
 
+def checkmptsas():
+    status = 0
+    if not os.path.exists('/usr/sbin/mpt-status'):
+        print 'mpt-status not installed'
+        return 255
+
+    try:
+        proc = subprocess.Popen([
+                                '/usr/sbin/mpt-status',
+                                '--autoload',
+                                '--status_only'],
+                                stdout=subprocess.PIPE)
+    except Exception as e:
+        print 'Unable to execute mpt-status: %s' % e
+        return 254
+
+    log_drive_re = re.compile('^log_id \d (\w+)$')
+    phy_drive_re = re.compile('^phys_id (\d) (\w+)$')
+
+    for line in proc.stdout:
+        m = log_drive_re.match(line)
+        if m is not None:
+            print 'RAID STATUS: %s' % m.group(1)
+            if m.group(1) != 'OPTIMAL':
+                status = 1
+        m = phy_drive_re.match(line)
+        if m is not None:
+            print 'DISK %s STATUS: %s' % (m.group(1), m.group(2))
+
+    proc.wait()
+
+    return status
+
+
 def checkAdaptec():
     # Need to change directory so that the log file goes to the right place
     oldDir = os.getcwd()
diff --git a/modules/base/manifests/monitoring/host.pp 
b/modules/base/manifests/monitoring/host.pp
index 2266622..0abfaaa 100644
--- a/modules/base/manifests/monitoring/host.pp
+++ b/modules/base/manifests/monitoring/host.pp
@@ -21,10 +21,15 @@
     monitor_service { 'ssh': description => 'SSH', check_command => 
'check_ssh', contact_group => $contact_group }
 
     if $::network_zone == 'internal' {
-        package { [ 'megacli', 'arcconf' ]:
+        package { [ 'megacli', 'arcconf', 'mpt-status' ]:
             ensure => 'latest',
         }
 
+        service { 'mpt-statusd':
+            ensure => stopped,
+            enable => false,
+        }
+
         file { '/usr/local/bin/check-raid.py':
             ensure => present,
             owner  => root,

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

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

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

Reply via email to