From 4aa1848ece6abeeb3447aaf76380fe1f1b479a43 Mon Sep 17 00:00:00 2001 From: Jokob-sk Date: Thu, 13 Apr 2023 22:30:27 +1000 Subject: [PATCH] Code cleanup --- back/pialert.py | 15 --------------- front/plugins/snmp_discovery/config.json | 2 +- front/plugins/snmp_discovery/script.py | 7 ------- front/plugins/unifi_import/config.json | 4 ++-- 4 files changed, 3 insertions(+), 25 deletions(-) diff --git a/back/pialert.py b/back/pialert.py index 647cb48a..f3ddec04 100755 --- a/back/pialert.py +++ b/back/pialert.py @@ -4160,21 +4160,6 @@ def combine_plugin_objects(old, new): # return the new object, with some of the old values return new -#------------------------------------------------------------------------------- -# Replace {wildcars} with parameters -def resolve_wildcards(command, params): - - mylog('debug', [' [Plugins]: Pre-Resolved CMD: ', command]) - - for param in params: - mylog('debug', [' [Plugins]: key : {', param[0], '}']) - mylog('debug', [' [Plugins]: resolved: ', param[1]]) - command = command.replace('{' + param[0] + '}', param[1]) - - mylog('debug', [' [Plugins]: Resolved CMD: ', command]) - - return command - #------------------------------------------------------------------------------- # Replace {wildcars} with parameters def resolve_wildcards_arr(commandArr, params): diff --git a/front/plugins/snmp_discovery/config.json b/front/plugins/snmp_discovery/config.json index 4e4034d9..a516e233 100755 --- a/front/plugins/snmp_discovery/config.json +++ b/front/plugins/snmp_discovery/config.json @@ -256,7 +256,7 @@ }], "description": [{ "language_code":"en_us", - "string" : "A list of snmpwalk commands to execute against IP addresses of roputers/switches with SNMP turned on.

Example:
snmpwalk -v 2c -c public -OXsq 192.168.1.1 .1.3.6.1.2.1.3.1.1.2

Only IPv4 supported. Authentication is not supported." + "string" : "A list of snmpwalk commands to execute against IP addresses of roputers/switches with SNMP turned on.

Example with the router on the IP 192.168.1.1:
snmpwalk -v 2c -c public -OXsq 192.168.1.1 .1.3.6.1.2.1.3.1.1.2

Only IPv4 supported. Authentication is not supported. More info on the plugin here." }] }, { diff --git a/front/plugins/snmp_discovery/script.py b/front/plugins/snmp_discovery/script.py index 8e362c25..8a7446a9 100755 --- a/front/plugins/snmp_discovery/script.py +++ b/front/plugins/snmp_discovery/script.py @@ -75,7 +75,6 @@ def get_entries(newEntries): timeoutSec = 10 - # snmpwalkArgs = ['snmpwalk', '-v', '2c', '-c', 'public', '-OXsq', router, '.1.3.6.1.2.1.3.1.1.2'] snmpwalkArgs = router.split(' ') # Execute N probes and insert in list @@ -93,18 +92,12 @@ def get_entries(newEntries): # debug run_logfile.write(line) - # print(line) - tmpSplt = line.split('"') if len(tmpSplt) == 3: ipStr = tmpSplt[0].split('.') # contains IP - # print(len(tmpSplt)) - # print(tmpSplt[0]) - # print(tmpSplt[1]) - macStr = tmpSplt[1].split(' ') # contains MAC if 'iso.' in line and len(ipStr) == 16: diff --git a/front/plugins/unifi_import/config.json b/front/plugins/unifi_import/config.json index d867909d..876734ac 100755 --- a/front/plugins/unifi_import/config.json +++ b/front/plugins/unifi_import/config.json @@ -182,7 +182,7 @@ "localized": ["name"], "name":[{ "language_code":"en_us", - "string" : "Network" + "string" : "Is online?" }] } , { @@ -208,7 +208,7 @@ "localized": ["name"], "name":[{ "language_code":"en_us", - "string" : "Hostname" + "string" : "Network" }] }, {