mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
PowerDNS-Recurosor improvements
Add config variables for direct connection Fix spelling
This commit is contained in:
@@ -92,7 +92,11 @@ A recursive DNS server: https://www.powerdns.com/recursor.html
|
||||
##### Direct
|
||||
The LibreNMS polling host must be able to connect to port 8082 on the monitored device.
|
||||
The web-server must be enabled, see the Recursor docs: https://doc.powerdns.com/md/recursor/settings/#webserver
|
||||
There is currently no way to specify a custom port or password.
|
||||
|
||||
###### Variables
|
||||
`$config['apps']['powerdns-recursor']['api-key']` required, this is defined in the Recursor config
|
||||
`$config['apps']['powerdns-recursor']['port']` numeric, defines the port to connect to PowerDNS Recursor on. The default is 8082
|
||||
`$config['apps']['powerdns-recursor']['https']` true or false, defaults to use http.
|
||||
|
||||
##### Agent
|
||||
[Install the agent](#agent-setup) on this device if it isn't already and copy the `powerdns-recursor` script to `/usr/lib/check_mk_agent/local/`
|
||||
|
@@ -24,19 +24,27 @@
|
||||
* @author Tony Murray <murraytony@gmail.com>
|
||||
*/
|
||||
|
||||
echo ' powerdns-recrusor';
|
||||
|
||||
global $config;
|
||||
$data = '';
|
||||
|
||||
$name = 'powerdns-recursor';
|
||||
$app_id = $app['app_id'];
|
||||
|
||||
echo ' ' . $name;
|
||||
|
||||
if ($agent_data['app'][$name]) {
|
||||
$data = $agent_data['app'][$name];
|
||||
} elseif (isset($config['apps'][$name]['api-key'])) {
|
||||
if (isset($config['apps'][$name]['port']) && is_numeric($config['apps'][$name]['port'])) {
|
||||
$port = $config['apps'][$name]['port'];
|
||||
} else {
|
||||
$port = '8082';
|
||||
}
|
||||
|
||||
$scheme = (isset($config['apps'][$name]['https']) && $config['apps'][$name]['https']) ? 'https://' : 'http://';
|
||||
|
||||
d_echo("\nNo Agent Data. Attempting to connect directly to the powerdns-recursor server " . $device['hostname'] . ":8082\n");
|
||||
$context = stream_context_create(array('http' => array('header' => 'X-API-Key: ' . $config['apps'][$name]['api-key'])));
|
||||
$data = file_get_contents('http://' . $device['hostname'] . ':8082/servers/localhost/statistics', false, $context);
|
||||
$data = file_get_contents($scheme . $device['hostname'] . ':' . $port . '/servers/localhost/statistics', false, $context);
|
||||
}
|
||||
|
||||
if (!empty($data)) {
|
||||
|
Reference in New Issue
Block a user