Volans has submitted this change and it was merged.

Change subject: Icinga: raid_handler improve failure detection
......................................................................


Icinga: raid_handler improve failure detection

Bug: T142085
Change-Id: Ie89d0ea765d271681a08d9f39b0aa93bc482d27a
---
M modules/icinga/files/raid_handler.py
1 file changed, 8 insertions(+), 3 deletions(-)

Approvals:
  Elukey: Looks good to me, but someone else must approve
  Volans: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/icinga/files/raid_handler.py 
b/modules/icinga/files/raid_handler.py
index b81302b..9c5a03d 100644
--- a/modules/icinga/files/raid_handler.py
+++ b/modules/icinga/files/raid_handler.py
@@ -18,7 +18,7 @@
 RAID_TYPES = ('megacli', 'hpssacli', 'mpt', 'md')
 COMPRESSED_RAID_TYPES = ('megacli', 'hpssacli')
 
-SKIP_STRINGS = ('timeout', 'timed out', 'connection refused')
+SKIP_STRINGS = ('timeout', 'timed out', 'connection refused', 'out of bounds')
 
 LOG_PATH = '/var/log/icinga/raid_handler.log'
 COMMAND_FILE = '/var/lib/nagios/rw/nagios.cmd'
@@ -91,9 +91,14 @@
                         '-c', NRPE_REMOTE_COMMAND.format(raid_type)]
         proc = subprocess.Popen(nrpe_command, stdout=subprocess.PIPE)
         stdout, stderr = proc.communicate()
+        if proc.returncode != 0 or len(stdout) == 0:
+            raise RuntimeError(
+                'RETCODE: {code}\nSTDOUT:\n{out}\nSTDERR:\n{err}'.format(
+                    code=proc.returncode, out=stdout, err=stderr))
     except Exception as e:
-        logger.error("Unable to execute '{}': {}".format(nrpe_command, e))
-        raise
+        status = "Failed to execute '{}': {}".format(nrpe_command, e)
+        logger.error(status)
+        return status
 
     if raid_type in COMPRESSED_RAID_TYPES:
         # NRPE doesn't handle NULL bytes, decoding them.

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie89d0ea765d271681a08d9f39b0aa93bc482d27a
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Volans <[email protected]>
Gerrit-Reviewer: Elukey <[email protected]>
Gerrit-Reviewer: Faidon Liambotis <[email protected]>
Gerrit-Reviewer: Volans <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to