Akosiaris has uploaded a new change for review.

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


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, 42 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/34/94134/1

diff --git a/modules/base/files/monitoring/check-raid.py 
b/modules/base/files/monitoring/check-raid.py
index 09a38c2..e5eaab8 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):
@@ -103,6 +111,35 @@
 
     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
diff --git a/modules/base/manifests/monitoring/host.pp 
b/modules/base/manifests/monitoring/host.pp
index 2266622..670d4d2 100644
--- a/modules/base/manifests/monitoring/host.pp
+++ b/modules/base/manifests/monitoring/host.pp
@@ -21,10 +21,14 @@
     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 => disabled,
+        }
+
         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: newchange
Gerrit-Change-Id: I4468bd331c84322b229129e5f73b0610005e33ac
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Akosiaris <[email protected]>

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

Reply via email to