From 8ff20f328353f1159a28af33e772cdd11bac8bf1 Mon Sep 17 00:00:00 2001 From: George Pochiscan Date: Thu, 3 Sep 2020 10:09:10 +0300 Subject: [PATCH] cleanup code --- .../check_mk/agents/special/agent_hitachivsp | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/hitachi-vsp/share/check_mk/agents/special/agent_hitachivsp b/hitachi-vsp/share/check_mk/agents/special/agent_hitachivsp index 887482f..5831ac7 100755 --- a/hitachi-vsp/share/check_mk/agents/special/agent_hitachivsp +++ b/hitachi-vsp/share/check_mk/agents/special/agent_hitachivsp @@ -28,7 +28,7 @@ import sys import getopt import pprint import json -#from requests.packages.urllib3.exceptions import InsecureRequestWarning +from requests.packages.urllib3.exceptions import InsecureRequestWarning def usage(): @@ -91,7 +91,7 @@ def output(line): # if type(line) not in [str]: # output_lines.append(pprint.pprint(line)) # else: - output_lines.append(line) + output_lines.append(line) def get_storage_info(): @@ -125,11 +125,12 @@ def get_storage_ldevs(): url = "https://%(address)s/ConfigurationManager/v1/objects/ldevs" % args_dict return query(url) + def get_storage_parity_groups(): if opt_demo: raw_json = storage_parity_groups return raw_json - url = "https://%(address)s/ConfigurationManager/v1/objects/parity-groups" %args_dict + url = "https://%(address)s/ConfigurationManager/v1/objects/parity-groups" % args_dict return query(url) @@ -137,7 +138,7 @@ def get_storage_hardware_status(): if opt_demo: raw_json = storage_hardware_status return raw_json - url = "https://%(address)s/ConfigurationManager/v1/objects/components/instance" %args_dict + url = "https://%(address)s/ConfigurationManager/v1/objects/components/instance" % args_dict return query(url) @@ -151,8 +152,8 @@ def process_storage_hardware_status(): output("<<>>") output("location\tstatus\ttemperature\ttemperatureStatus\tcharge") for ctl in ctls: - output("%s\t%s\t%s\t%s\t%s" % ( ctl["location"], ctl["status"], ctl["temperature"], ctl["temperatureStatus"], - ctl["charge"] )) + output("%s\t%s\t%s\t%s\t%s" % (ctl["location"], ctl["status"], ctl["temperature"], ctl["temperatureStatus"], + ctl["charge"])) cachememories = full_data["cacheMemories"] output("<<>>") @@ -160,17 +161,17 @@ def process_storage_hardware_status(): for cachemem in cachememories: output("%s\t%s\t%s" % (cachemem["location"], cachemem["status"], cachemem["cacheSize"])) - channelsboards=full_data["chbs"] + channelsboards = full_data["chbs"] output("<<>>") output("location\tstatus\ttype") for channelboard in channelsboards: output("%s\t%s\t%s" % (channelboard["location"], channelboard["status"], channelboard["type"])) - cacheFlashMemories=full_data["cacheFlashMemories"] + cacheflashmemories = full_data["cacheFlashMemories"] output("<<>>") output("location\tstatus\ttype") - for cacheFlashMemory in cacheFlashMemories: - output("%s\t%s\t%s" % (cacheFlashMemory["location"], cacheFlashMemory["status"], cacheFlashMemory["type"])) + for cacheflashmemory in cacheflashmemories: + output("%s\t%s\t%s" % (cacheflashmemory["location"], cacheflashmemory["status"], cacheflashmemory["type"])) disk_boards = full_data["dkbs"] output("<<>>") @@ -182,7 +183,7 @@ def process_storage_hardware_status(): output("<<>>") output("portId\tstatus\ttype\tspeed\tportCondition") for sfp in sfps: - output("%s\t%s\t%s\t%s\t%s" % (sfp["portId"], sfp["status"], sfp["type"], sfp["speed"], sfp["portCondition"] )) + output("%s\t%s\t%s\t%s\t%s" % (sfp["portId"], sfp["status"], sfp["type"], sfp["speed"], sfp["portCondition"])) backup_modules = full_data["bkmfs"] output("<<>>")