diff --git a/fastgate_check.py b/fastgate_check.py index 86e7df1..6e040c4 100644 --- a/fastgate_check.py +++ b/fastgate_check.py @@ -1,9 +1,9 @@ from .agent_based_api.v1 import register, Result, Service, State - ############### # DEVICE LIST # ############### + def parse_fastgate_device_list(string_table): result = {} @@ -104,15 +104,13 @@ def parse_fastgate_port_mapping(string_table): for line in string_table: parts = line - name, state, start, end, device, ip, prot = parts + name, state, start, end, ip, prot = parts result [name] = { "state": int(state), "start": int(start), "end": int(end), - "device": str(device), "ip": str(ip), "prot": str(prot) - } return result @@ -127,12 +125,13 @@ def check_fastgate_port_mapping(item, section): state = section[item]["state"] start = section[item]["start"] end = section[item]["end"] - device = section[item]["device"] ip = section[item]["ip"] protocol = section[item]["prot"] - + if state == 1: - yield Result(state=State.OK, summary=f"{protocol}: {start}:{end} - ip: {ip}({device})") + yield Result(state=State.OK, summary=f"{protocol}: {start}:{end} - ip: {ip}") + else: + yield Result(state=State.OK, summary=f"[DISABLED] {protocol}: {start}:{end} - ip: {ip}") except Exception as e: print(e)