Code cleanup

This commit is contained in:
Jokob-sk
2023-04-13 22:30:27 +10:00
parent 2176c58cb5
commit 4aa1848ece
4 changed files with 3 additions and 25 deletions

View File

@@ -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):

View File

@@ -256,7 +256,7 @@
}],
"description": [{
"language_code":"en_us",
"string" : "A list of <code>snmpwalk</code> commands to execute against IP addresses of roputers/switches with SNMP turned on. <br/> <br/> Example: <br/> <code>snmpwalk -v 2c -c public -OXsq 192.168.1.1 .1.3.6.1.2.1.3.1.1.2</code> <br/><br/> Only IPv4 supported. Authentication is not supported."
"string" : "A list of <code>snmpwalk</code> commands to execute against IP addresses of roputers/switches with SNMP turned on. <br/> <br/> Example with the router on the IP <code>192.168.1.1</code>: <br/> <code>snmpwalk -v 2c -c public -OXsq 192.168.1.1 .1.3.6.1.2.1.3.1.1.2</code> <br/><br/> Only IPv4 supported. Authentication is not supported. More info on the plugin <a href='https://github.com/jokob-sk/Pi.Alert/tree/main/front/plugins/snmp_discovery' target='_blank'>here</a>."
}]
},
{

View File

@@ -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:

View File

@@ -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"
}]
},
{