mirror of
https://github.com/librenms/librenms-agent.git
synced 2024-05-09 09:54:52 +00:00
* Format with isort * Format with Black * Fix CRLF * Format with shellcheck * Fix some warning * Fix PHP style * Dont modifiy check_mk files * Fixes
29 lines
545 B
Python
Executable File
29 lines
545 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
import json
|
|
import subprocess
|
|
|
|
pdnscontrol = "/usr/bin/pdns_control"
|
|
|
|
process = subprocess.Popen(
|
|
[pdnscontrol, "show", "*"], stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
)
|
|
input = process.communicate()
|
|
stdout = input[0].decode()
|
|
stderr = input[1].decode()
|
|
|
|
data = {}
|
|
for var in stdout.split(","):
|
|
if "=" in var:
|
|
key, value = var.split("=")
|
|
data[key] = value
|
|
|
|
output = {
|
|
"version": 1,
|
|
"error": process.returncode,
|
|
"errorString": stderr,
|
|
"data": data,
|
|
}
|
|
|
|
print(json.dumps(output))
|