mirror of
https://github.com/librenms/librenms-agent.git
synced 2024-05-09 09:54:52 +00:00
- `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.
14 lines
356 B
Python
Executable File
14 lines
356 B
Python
Executable File
#!/usr/bin/env python3
|
|
import json, subprocess
|
|
from subprocess import Popen, PIPE
|
|
|
|
input = Popen(['rec_control', 'get-all'], stdout=PIPE).communicate()[0]
|
|
data = []
|
|
|
|
for line in input.splitlines():
|
|
item = line.split()
|
|
data.append({'name': item[0].decode(), 'value': int(item[1].decode())})
|
|
|
|
print('<<<powerdns-recursor>>>')
|
|
print(json.dumps(data))
|