mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 01:26:11 -08:00
Code cleanup
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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>."
|
||||
}]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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"
|
||||
}]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user