From 1bab17e3045df2788299b4abf460205005c75445 Mon Sep 17 00:00:00 2001 From: 6d6178 Date: Thu, 20 Sep 2018 13:35:03 +0000 Subject: [PATCH 1/2] Update idrac_2.2rc4 --- idrac_2.2rc4 | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/idrac_2.2rc4 b/idrac_2.2rc4 index f967f0b..f8c6a04 100755 --- a/idrac_2.2rc4 +++ b/idrac_2.2rc4 @@ -2,7 +2,7 @@ __author__ = 'Nguyen Duc Trung Dung' __contact__ = 'ndtdung@spsvietnam.vn - dung.nguyendt@gmail.com' __blog__ = 'dybn.blogspot.com' -__version__ = '2.2rc4' +__version__ = '2.2rc5' __license__ = 'GPLv3' import commands @@ -172,6 +172,7 @@ def cli_reader(): optp.add_option('-n', '--no-alert', help='always return with exit code 0', action='store_true', dest='no_alert') optp.add_option('-w', help='hardware to check. If no hardware specified, all will be listed: DISK, VDISK, FAN, SENSOR, CPU, PS, PU, MEM, BATTERY', dest='hardware', metavar='FAN|FAN#1|MEM') optp.add_option('-p', help='enable performance data', dest='perf', action='store_true') + optp.add_option('-i', help='only display WARN and CRIT, else OK', dest='style', action='store_true') optp.add_option('--fan-warn', help='FAN rpm warning thresholds', dest='fan_warn', metavar='MIN,MAX') optp.add_option('--fan-crit', help='FAN rpm critical thresholds', dest='fan_crit', metavar='MIN,MAX') optp.add_option('--temp-warn', help='TEMPERATURE warning thresholds', dest='temp_warn', metavar='MIN,MAX') @@ -211,6 +212,8 @@ def cli_reader(): if opts.crit: conf['state_crit'] = opts.crit if opts.no_alert is True: conf['alert'] = False if opts.perf is True: conf['perf'] = True + if opts.style is True: conf['style'] = True + else: conf['style'] = False # parse fan threshold conf['fan_thresholds'] = [] for x in [opts.fan_warn, opts.fan_crit]: @@ -842,7 +845,26 @@ if __name__ == '__main__': config_verify() if conf['hardware'] is None: # check all hardware exit_code = 0 - for key in all_hardware.keys(): + if conf['style'] is True: + for key in all_hardware.keys(): + conf['hardware'] = [key, None] + hw_info = all_hardware[key] + result, tmp_code = PARSER().main() + if tmp_code[0] == 2: + exit_code = tmp_code[0] + for line in result: + if "CRITICAL" in line and "systemStateGlobal" not in line: + print(line) + elif tmp_code[0] == 1: + for line in result: + if "(!)" in line and "systemStateGlobal" not in line: + print(line) + if exit_code != 2: + exit_code = tmp_code[0] + if exit_code == 0: + print("OK") + else: + for key in all_hardware.keys(): conf['hardware'] = [key, None] hw_info = all_hardware[key] result, tmp_code = PARSER().main() From 9118f557ccef8c977bee4439e0f832735bbc72d7 Mon Sep 17 00:00:00 2001 From: 6d6178 Date: Thu, 20 Sep 2018 13:35:40 +0000 Subject: [PATCH 2/2] Rename idrac_2.2rc4 to idrac_2.2rc5 --- idrac_2.2rc4 => idrac_2.2rc5 | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename idrac_2.2rc4 => idrac_2.2rc5 (100%) diff --git a/idrac_2.2rc4 b/idrac_2.2rc5 similarity index 100% rename from idrac_2.2rc4 rename to idrac_2.2rc5