From 6a12ae975cf7b546d39fe222e6a6fe16b202d3ab Mon Sep 17 00:00:00 2001 From: nicole Date: Wed, 13 Nov 2024 17:33:19 +0000 Subject: [PATCH] Update fastgate_check.py --- fastgate_check.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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)