gpsd script occasionally results in python error.
cause: the expected info from GPS unit on each update has more than 10 lines, therefore, python didn't find the expected wording and result in a python error
correction: increase the line from gpspipe from 10 to 20 lines
When checking if arrays have slaves, the mdadm script, does an ls/$LS of the device to see if it exists.
This $LS throws an error to STDERR if it does not match.
This output is caught by snmp and corrupts the json output
--recv-only argument doesn't exist on some well used version of netcat. This method timesout after 1 second of idle time.
Only possible downside is that if it takes more than 1 second to initiate the connection it may timeout too.
Check if /etc/version file present for FreeBSD OS
Without fix on FreeBSD: ./distro
cat: /etc/version: No such file or directory
FreeBSD 12.1-RELEASE-p5 amd64 GENERIC
* Updated to work with python3
Thanks to @murrant this file is now python3 compatible.
* Formatted for PEP8 specs
* Updated except according to request
* Updated according to request
As requested [here](https://github.com/librenms/librenms/pull/12009) by SourceDoctor.
To minimize the impact of future API changes in terms of data order or additional data being appended, required elements are selected directly with the jq tool in the expected order.
- `agent-local/powerdns`
- Replaced the absolute path `/usr/bin/pdns_control` with `pdns_control`, since pdns_control can also be in `/usr/sbin` or `/usr/local/bin`.
Python can find the executable using PATH just fine.
- Changed `vars` to `kvars` to avoid conflicting with the reserved `vars` Python symbol
- Changed shebang to use `python3` instead of `python` - as Python 2 is EOL.
- `agent-local/powerdns-recursor`
- Changed shebang to use `/usr/bin/env` instead of a hardcoded path to Python
- Changed shebang to use `python3` instead of `python` - as Python 2 is EOL.
**NOTE:** As per https://pythonclock.org/ - Python 2 is end-of-life, and is no longer included by default on modern Linux distros,
along with macOS (OS X).
I would recommend adjusting all Python-based agents to use Python 3 by default, instead of Python 2.
4s max time limit was causing some timeouts, especially given the two 1s sleeps. Especially with a lot of sentences coming back from the GPS chip it was probably not enough to always catch the right variables.