pucherot / Pi.Alert

WIFI / LAN intruder detector. Check the devices connected and alert you with unknown devices. It also warns of the disconnection of "always connected" devices
GNU General Public License v3.0
1.97k stars 121 forks source link

SNMP Plugin #228

Open agirdea opened 1 year ago

agirdea commented 1 year ago

Hi, Having troubles with runing the SNMP plug in. Running the snmpwalk command by itself produces the expected result, but not the plugin. Below is the debug report, for trying to run it on the router 192.168.111.1.

 [Plugins] ---------------------------------------------
 [Plugins] display_name: SNMP discovery
 [Plugins] CMD: python3 /home/pi/pialert/front/plugins/snmp_discovery/script.py routers={s-quote}{routers}{s-quote}
 [Plugins] Timeout: 5

192.168.111.1: snmpwalk -v 2c -c public -OXsq 192.168.111.1 .1.3.6.1.2.1.3.1.1.2 [Plugins]: Pre-Resolved CMD: python3/home/pi/pialert/front/plugins/snmp_discovery/script.pyrouters={s-quote}{routers}{s-quote} [Plugins] Executing: python3 /home/pi/pialert/front/plugins/snmp_discovery/script.py routers={s-quote}{routers}{s-quote} [Plugins] Resolved : ['python3', '/home/pi/pialert/front/plugins/snmp_discovery/script.py', "routers='192.168.111.1: snmpwalk -v 2c -c public -OXsq 192.168.111.1 .1.3.6.1.2.1.3.1.1.2'"] 192.168.111.1: snmpwalk -v 2c -c public -OXsq 192.168.111.1 .1.3.6.1.2.1.3.1.1.2 Traceback (most recent call last): File "/home/pi/pialert/front/plugins/snmp_discovery/script.py", line 169, in main()
File "/home/pi/pialert/front/plugins/snmp_discovery/script.py", line 53, in main newEntries = get_entries(newEntries)
File "/home/pi/pialert/front/plugins/snmp_discovery/script.py", line 85, in get_entries output = subprocess.check_output (snmpwalkArgs, universal_newlines=True, stderr=subprocess.STDOUT, timeout=(timeoutSec )) File "/usr/lib/python3.9/subprocess.py", line 424, in check_output return run(popenargs, stdout=PIPE, timeout=timeout, check=True, File "/usr/lib/python3.9/subprocess.py", line 505, in run with Popen(popenargs, **kwargs) as process: File "/usr/lib/python3.9/subprocess.py", line 951, in init self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.9/subprocess.py", line 1823, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: '192.168.111.1:'

    [Plugins] Error - enable LOG_LEVEL=debug and check logs
    [Plugins] No output received from the plugin SNMPDSC - enable LOG_LEVEL=debug and check logs
leiweibau commented 1 year ago

Plugins are supported only by @jokob-sk. So if you need help, open an issue in his fork (https://github.com/jokob-sk/Pi.Alert/issues)