Skip to content

Commit aa5c8e5

Browse files
authored
Default AdGuard HTTP timeout to 1 second (#630)
LibreNMS defaults to a 1s SNMP timeout. A 5s per-call hang ceiling overruns that. If the API is slow, cache via cron instead.
1 parent 3e13fb9 commit aa5c8e5

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

snmp/adguard

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,18 @@ Configuration is read from a JSON file (default /etc/snmp/adguard.json):
1111
"url": "http://127.0.0.1:3000",
1212
"username": "admin",
1313
"password": "secret",
14-
"timeout": 5,
14+
"timeout": 1,
1515
"insecure": false
1616
}
1717
1818
"url" is the base URL of the AdGuard Home web interface. "insecure" disables
19-
TLS certificate verification for https URLs. "timeout" applies to each of
20-
the two API calls, so the SNMP timeout must exceed 2 * timeout. The config
21-
file holds the web UI credentials, so restrict it to the user snmpd runs
22-
extend scripts as (root:Debian-snmp mode 0640 on Debian/Ubuntu, root-only
23-
0600 where snmpd runs as root).
19+
TLS certificate verification for https URLs. "timeout" is seconds per API
20+
call (two calls per poll). LibreNMS defaults to a 1 second SNMP timeout;
21+
if the API is remote or slow, run the script from cron and have snmpd cat
22+
the cache instead of raising the SNMP timeout. The config file holds the
23+
web UI credentials, so restrict it to the user snmpd runs extend scripts
24+
as (root:Debian-snmp mode 0640 on Debian/Ubuntu, root-only 0600 where
25+
snmpd runs as root).
2426
2527
snmpd.conf entry:
2628
@@ -90,7 +92,7 @@ def main():
9092
output({}, 1, "config error: {}".format(error))
9193

9294
auth_header = "Basic " + base64.b64encode(credentials.encode()).decode()
93-
timeout = config.get("timeout", 5)
95+
timeout = config.get("timeout", 1)
9496
insecure = bool(config.get("insecure", False))
9597

9698
data = {}

0 commit comments

Comments
 (0)