File monitoring-plugins-aacraid-fix_deprecated_and_enhancements.patch of Package monitoring-plugins-aacraid

--- check-aacraid.py.orig	2012-07-03 09:44:00.936430650 +0200
+++ check-aacraid.py	2012-07-03 09:44:15.466000811 +0200
@@ -28,10 +28,11 @@
 
 
 import sys, os, re, string
+import subprocess
 
 c_status_re = re.compile('^\s*Controller Status\s*:\s*(.*)$')
-l_status_re = re.compile('^\s*Status of logical device\s*:\s*(.*)$')
-l_device_re = re.compile('^Logical device number ([0-9]+).*$')
+l_status_re = re.compile('^\s*Status of logical (device|drive)\s*:\s*(.*)$')
+l_device_re = re.compile('^Logical (device|drive) number ([0-9]+).*$')
 c_defunct_re = re.compile('^\s*Defunct disk drive count\s:\s*([0-9]+).*$')
 c_degraded_re = re.compile('^\s*Logical devices/Failed/Degraded\s*:\s*([0-9]+)/([0-9]+)/([0-9]+).*$')
 b_status_re = re.compile('^\s*Status\s*:\s*(.*)$')
@@ -44,24 +45,24 @@
 check_status = 0
 result = ""
 
-for line in os.popen4("/usr/bin/sudo /usr/StorMan/arcconf GETCONFIG 1 LD")[1].readlines():
+for line in subprocess.Popen("/usr/bin/sudo /usr/StorMan/arcconf GETCONFIG 1 LD", shell=True, stdout=subprocess.PIPE).stdout.readlines():
 	# Match the regexs
 	ldevice = l_device_re.match(line)
 	if ldevice:
-		lnum = ldevice.group(1)
+		lnum = ldevice.group(2)
 		continue
 
 	lstatus = l_status_re.match(line)
 	if lstatus:
-		if lstatus.group(1) != "Optimal":
+		if lstatus.group(2) not in ("Okay", "Optimal"):
 			check_status = 2
-		result += "Logical Device " + lnum + " " + lstatus.group(1) + ","
+		result += "Logical Device " + lnum + " " + lstatus.group(2) + ","
 
-for line in os.popen4("/usr/bin/sudo /usr/StorMan/arcconf GETCONFIG 1 AD")[1].readlines():
+for line in subprocess.Popen("/usr/bin/sudo /usr/StorMan/arcconf GETCONFIG 1 AD", shell=True, stdout=subprocess.PIPE).stdout.readlines():
 	# Match the regexs
 	cstatus = c_status_re.match(line)
 	if cstatus:
-		if cstatus.group(1) != "Optimal":
+		if cstatus.group(1) not in ("Okay", "Optimal"):
 			check_status = 2
 		result += "Controller " + cstatus.group(1) + ","
 		continue
@@ -91,7 +92,7 @@
 		if bstatus.group(1) == "Charging":
 			if check_status < 2:
 				check_status = 1
-		elif bstatus.group(1) != "Optimal":
+		elif bstatus.group(1) not in ("Okay", "Optimal", "ZMM Optimal"): 
 			check_status = 2
 		result += "Battery Status " + bstatus.group(1) + ","
 		continue
openSUSE Build Service is sponsored by