mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
SNMPDSC plugin 0.2
This commit is contained in:
@@ -6,10 +6,10 @@ A plugin for importing devices from an SNMP enabled router or switch.
|
||||
|
||||
Specify the following settings in the Settings section of PiAlert:
|
||||
|
||||
- `SNMPDSC_routers` - A list of IP addresses of roputers/switches with SNMP turned on.
|
||||
- `SNMPDSC_routers` - A list of `snmpwalk` commands to execute against IP addresses of roputers/switches with SNMP turned on. For example: `snmpwalk -v 2c -c public -OXsq 192.168.1.1 .1.3.6.1.2.1.3.1.1.2`
|
||||
|
||||
### Notes
|
||||
|
||||
- Executing the `snmpwalk -v 2c -c public -OXsq <IP> .1.3.6.1.2.1.3.1.1.2` command.
|
||||
- Only IPv4 supported.
|
||||
- Expected output in format `iso.3.6.1.2.1.3.1.1.2.3.1.192.168.1.2 "6C 6C 6C 6C 6C 6C "`.
|
||||
- Authentication is not supported.
|
||||
- Only IPv4 supported.
|
||||
- Expected output (ingestion) in format `iso.3.6.1.2.1.3.1.1.2.3.1.192.168.1.2 "6C 6C 6C 6C 6C 6C "`.
|
||||
@@ -232,7 +232,7 @@
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "text",
|
||||
"default_value":"python3 /home/pi/pialert/front/plugins/snmp_discovery/script.py routers={routers} ",
|
||||
"default_value":"python3 /home/pi/pialert/front/plugins/snmp_discovery/script.py routers='{routers}' ",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name" : [{
|
||||
@@ -247,7 +247,7 @@
|
||||
{
|
||||
"function": "routers",
|
||||
"type": "list",
|
||||
"default_value":["192.168.1.1"],
|
||||
"default_value":["snmpwalk -v 2c -c public -OXsq 192.168.1.1 .1.3.6.1.2.1.3.1.1.2"],
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name" : [{
|
||||
@@ -256,7 +256,7 @@
|
||||
}],
|
||||
"description": [{
|
||||
"language_code":"en_us",
|
||||
"string" : "The router IP addresses you want to connect to. SNMP has to be enabled on the target devices."
|
||||
"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."
|
||||
}]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Example call
|
||||
# python3 /home/pi/pialert/front/plugins/snmp_discovery/script.py routers=192.168.1.1
|
||||
# python3 /home/pi/pialert/front/plugins/snmp_discovery/script.py routers='snmpwalk -v 2c -c public -OXsq 192.168.1.1 .1.3.6.1.2.1.3.1.1.2'
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from time import sleep, time, strftime
|
||||
@@ -47,7 +47,7 @@ def main():
|
||||
|
||||
if values.routers:
|
||||
|
||||
ROUTERS = values.routers.split('=')[1]
|
||||
ROUTERS = values.routers.split('=')[1].replace('\'','')
|
||||
|
||||
newEntries = get_entries(newEntries)
|
||||
|
||||
@@ -73,7 +73,8 @@ 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 = ['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
|
||||
probes = 1 # N probes
|
||||
|
||||
Reference in New Issue
Block a user