@@ -1,5 +1,5 @@
--- check_rhev.orig 2012-02-21 11:35:30.661735279 +0100
-+++ check_rhev 2012-02-21 12:34:46.132775917 +0100
++++ check_rhev 2012-02-21 12:51:11.157307027 +0100
@@ -24,12 +24,6 @@
WARNING = 1
CRITICAL = 2
@@ -13,7 +13,7 @@
# General macros
VDSM_PORT = 54321
TIMEOUT_SOCKET_SEC = 5
-@@ -98,11 +92,45 @@
+@@ -98,11 +92,52 @@
ssh.close()
i += 1
@@ -30,15 +30,22 @@
+ ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
+ try:
+ ssh.connect(hosts[i],username=user,password=passw)
-+ stdin, stdout, stderr = ssh.exec_command(VDSM_COMMAND + ' -s 0 list table|awk \'{print $(NF-1)}\'')
++ stdin, stdout, stderr = ssh.exec_command(VDSM_COMMAND + ' -s 0 list table|awk \'{print $(NF-1)","$NF}\'')
+ data = stdout.readlines()
+ output= ""
++ down = 0
+ for line in data:
-+ status = "Up"
-+ output += "OK: %s UP " % (line.strip('\n\r'))
++ vm,status = line.split(",")
++ if status != 'Up':
++ down += 1
++ output += "OK: %s %s " % (vm, status.strip('\n\r'))
++
+ output += "@ %s" % (hosts[i])
+ print output
-+ sys.exit(OK)
++ if down == '0':
++ sys.exit(OK)
++ else:
++ sys.exit(WARNING)
+ error = stderr.readlines()
+ for line in error:
+ status = "command not found"
@@ -59,7 +66,7 @@
parser.add_option("-v", "--verbose", action="store_true", dest="verbose")
parser.add_option("-q", "--quiet", action="store_false", dest="verbose")
parser.add_option("-t", "--type-service", action="store", dest="type_service")
-@@ -111,7 +139,7 @@
+@@ -111,7 +146,7 @@
parser.add_option("-p", "--password", action="store", dest="passw")
(options, args) = parser.parse_args()
@@ -68,7 +75,7 @@
print "UNKNOWN: please add your RHEV-H hosts into check_rhev!"
sys.exit(UNKNOWN)
-@@ -121,7 +149,7 @@
+@@ -121,7 +156,7 @@
# Generic calls - every option will use them
rhev = checkRHEV()
@@ -77,7 +84,7 @@
user = options.user
passw = options.passw
-@@ -141,6 +169,9 @@
+@@ -141,6 +176,9 @@
if options.type_service == 'checkVMS':
rhev.checkVMS(hosts, user, passw, guest)
sys.exit(CRITICAL)
|