From 57ee48adb74c1e49fb34a446e8c6a591411ce574 Mon Sep 17 00:00:00 2001 From: yayogev Date: Mon, 4 Sep 2017 15:07:33 +0300 Subject: vnic-vconnector status 1 on problem Change-Id: I896666e81f0a656936b0e77ce14b9effc8b444cb Signed-off-by: yayogev --- app/monitoring/checks/check_vnic_vconnector.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'app/monitoring') diff --git a/app/monitoring/checks/check_vnic_vconnector.py b/app/monitoring/checks/check_vnic_vconnector.py index b0f96cd..76efd0b 100755 --- a/app/monitoring/checks/check_vnic_vconnector.py +++ b/app/monitoring/checks/check_vnic_vconnector.py @@ -28,8 +28,10 @@ mac_address = str(sys.argv[2]) rc = 0 +cmd = None try: - out = subprocess.check_output(["brctl showmacs " + bridge_name], + cmd = "brctl showmacs " + bridge_name + out = subprocess.check_output([cmd], stderr=subprocess.STDOUT, shell=True) out = binary2str(out) @@ -45,8 +47,8 @@ try: line_number += 1 state_match = re.match('^\W+([A-Z]+)', line) if not found: - rc = 2 - print('Error: failed to find MAC {}:\n{}\n' + rc = 1 + print('Warning: failed to find MAC {}:\n{}\n' .format(mac_address, out)) else: # grab "is local?" and "ageing timer" values @@ -65,8 +67,8 @@ try: ageing_timer, mac_address, bridge_name, out) print(msg) except subprocess.CalledProcessError as e: - print("Error finding MAC {}: {}\n" - .format(mac_address, binary2str(e.output))) + print("Error running CLI command {}: {}\n" + .format(cmd, binary2str(e.output))) rc = 2 exit(rc) -- cgit 1.2.3-korg