mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Merge pull request #3869 from murrant/app-pdns-recursor
New App: Powerdns Recursor
This commit is contained in:
@@ -133,3 +133,15 @@ location /nginx-status {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### PowerDNS Recursor
|
||||||
|
A recursive DNS sever: https://www.powerdns.com/recursor.html
|
||||||
|
|
||||||
|
#### Direct Connection
|
||||||
|
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.
|
||||||
|
|
||||||
|
#### Agent
|
||||||
|
Copy powerdns-recursor to the `/usr/lib/check_mk_agent/local` directory.
|
||||||
|
The user check_mk is running as must be able to run `rec_control get-all`
|
||||||
|
30
html/includes/graphs/application/powerdns-recursor.inc.php
Normal file
30
html/includes/graphs/application/powerdns-recursor.inc.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* powerdns-recursor.inc.php
|
||||||
|
*
|
||||||
|
* -Description-
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* @package LibreNMS
|
||||||
|
* @link http://librenms.org
|
||||||
|
* @copyright 2016 Tony Murray
|
||||||
|
* @author Tony Murray <murraytony@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
$rrd = rrd_name($device['hostname'], array('app', 'powerdns-recursor', $app['app_id']));
|
||||||
|
if (is_file($rrd)) {
|
||||||
|
$rrd_filename = $rrd;
|
||||||
|
}
|
||||||
|
$simple_rrd = true;
|
@@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* powerdns-recursor_answers.inc.php
|
||||||
|
*
|
||||||
|
* Graph of answers
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* @package LibreNMS
|
||||||
|
* @link http://librenms.org
|
||||||
|
* @copyright 2016 Tony Murray
|
||||||
|
* @author Tony Murray <murraytony@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
include 'powerdns-recursor.inc.php';
|
||||||
|
|
||||||
|
$colours = 'oranges';
|
||||||
|
$unit_text = 'Answers/sec';
|
||||||
|
$print_total = true;
|
||||||
|
|
||||||
|
if (is_file($rrd_filename)) {
|
||||||
|
$rrd_list = array(
|
||||||
|
array(
|
||||||
|
'ds' => 'answers0-1',
|
||||||
|
'filename' => $rrd_filename,
|
||||||
|
'descr' => '0-1ms',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'ds' => 'answers1-10',
|
||||||
|
'filename' => $rrd_filename,
|
||||||
|
'descr' => '1-10ms',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'ds' => 'answers10-100',
|
||||||
|
'filename' => $rrd_filename,
|
||||||
|
'descr' => '10-100ms',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'ds' => 'answers100-1000',
|
||||||
|
'filename' => $rrd_filename,
|
||||||
|
'descr' => '100-1000ms',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'ds' => 'answers-slow',
|
||||||
|
'filename' => $rrd_filename,
|
||||||
|
'descr' => '>1s',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
echo "file missing: $rrd_filename";
|
||||||
|
}
|
||||||
|
|
||||||
|
require 'includes/graphs/generic_multi.inc.php';
|
@@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* powerdns-recursor_cache_performance.inc.php
|
||||||
|
*
|
||||||
|
* -Description-
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* @package LibreNMS
|
||||||
|
* @link http://librenms.org
|
||||||
|
* @copyright 2016 Tony Murray
|
||||||
|
* @author Tony Murray <murraytony@gmail.com>
|
||||||
|
*/
|
||||||
|
include 'powerdns-recursor.inc.php';
|
||||||
|
|
||||||
|
$colours = 'mixed';
|
||||||
|
$unit_text = 'Packets/sec';
|
||||||
|
|
||||||
|
if (is_file($rrd_filename)) {
|
||||||
|
$rrd_list = array(
|
||||||
|
array(
|
||||||
|
'filename' => $rrd_filename,
|
||||||
|
'ds' => 'cache-hits',
|
||||||
|
'descr' => 'Query Cache Hits',
|
||||||
|
'colour' => '297159',
|
||||||
|
'area' => true,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'filename' => $rrd_filename,
|
||||||
|
'ds' => 'cache-misses',
|
||||||
|
'descr' => 'Query Cache Misses',
|
||||||
|
'colour' => '73AC61',
|
||||||
|
'area' => true,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'filename' => $rrd_filename,
|
||||||
|
'ds' => 'packetcache-hits',
|
||||||
|
'descr' => 'Packet Cache Hits',
|
||||||
|
'colour' => 'BC7049',
|
||||||
|
'area' => true,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'filename' => $rrd_filename,
|
||||||
|
'ds' => 'packetcache-misses',
|
||||||
|
'descr' => 'Packet Cache Misses',
|
||||||
|
'colour' => 'C98F45',
|
||||||
|
'area' => true,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
echo "file missing: $rrd_filename";
|
||||||
|
}
|
||||||
|
|
||||||
|
require 'includes/graphs/generic_multi_line.inc.php';
|
@@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* powerdns-recursor_cache_size.inc.php
|
||||||
|
*
|
||||||
|
* -Description-
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* @package LibreNMS
|
||||||
|
* @link http://librenms.org
|
||||||
|
* @copyright 2016 Tony Murray
|
||||||
|
* @author Tony Murray <murraytony@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
include 'powerdns-recursor.inc.php';
|
||||||
|
|
||||||
|
$colours = 'purples';
|
||||||
|
$unit_text = 'Entries';
|
||||||
|
|
||||||
|
if (is_file($rrd_filename)) {
|
||||||
|
$rrd_list = array(
|
||||||
|
array(
|
||||||
|
'filename' => $rrd_filename,
|
||||||
|
'ds' => 'cache-entries',
|
||||||
|
'descr' => 'Query Cache',
|
||||||
|
'colour' => '202048',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'filename' => $rrd_filename,
|
||||||
|
'ds' => 'packetcache-entries',
|
||||||
|
'descr' => 'Packet Cache',
|
||||||
|
'colour' => 'CC7CCC',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
echo "file missing: $rrd_filename";
|
||||||
|
}
|
||||||
|
|
||||||
|
require 'includes/graphs/generic_multi_line.inc.php';
|
@@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* powerdns-recursor_outqueries.inc.php
|
||||||
|
*
|
||||||
|
* -Description-
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* @package LibreNMS
|
||||||
|
* @link http://librenms.org
|
||||||
|
* @copyright 2016 Tony Murray
|
||||||
|
* @author Tony Murray <murraytony@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
include 'powerdns-recursor.inc.php';
|
||||||
|
|
||||||
|
$colours = 'mixed';
|
||||||
|
$unit_text = 'Queries/sec';
|
||||||
|
|
||||||
|
if (is_file($rrd_filename)) {
|
||||||
|
$rrd_list = array(
|
||||||
|
array(
|
||||||
|
'filename' => $rrd_filename,
|
||||||
|
'ds' => 'all-outqueries',
|
||||||
|
'descr' => 'Total',
|
||||||
|
'area' => true,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'filename' => $rrd_filename,
|
||||||
|
'ds' => 'ipv6-outqueries',
|
||||||
|
'descr' => 'IPv6',
|
||||||
|
'area' => true,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'filename' => $rrd_filename,
|
||||||
|
'ds' => 'tcp-outqueries',
|
||||||
|
'descr' => 'TCP',
|
||||||
|
'area' => true,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'filename' => $rrd_filename,
|
||||||
|
'ds' => 'throttled-out',
|
||||||
|
'descr' => 'Throttled',
|
||||||
|
'area' => true,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'filename' => $rrd_filename,
|
||||||
|
'ds' => 'outgoing-timeouts',
|
||||||
|
'descr' => 'Timeouts',
|
||||||
|
'area' => true,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
echo "file missing: $rrd_filename";
|
||||||
|
}
|
||||||
|
|
||||||
|
require 'includes/graphs/generic_multi_line.inc.php';
|
@@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* powerdns-recursor_questions.inc.php
|
||||||
|
*
|
||||||
|
* -Description-
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* @package LibreNMS
|
||||||
|
* @link http://librenms.org
|
||||||
|
* @copyright 2016 Tony Murray
|
||||||
|
* @author Tony Murray <murraytony@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
include 'powerdns-recursor.inc.php';
|
||||||
|
|
||||||
|
$colours = 'mixed';
|
||||||
|
$unit_text = 'Questions/sec';
|
||||||
|
|
||||||
|
if (is_file($rrd_filename)) {
|
||||||
|
$rrd_list = array(
|
||||||
|
array(
|
||||||
|
'filename' => $rrd_filename,
|
||||||
|
'ds' => 'questions',
|
||||||
|
'descr' => 'Total Questions',
|
||||||
|
'area' => true,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'filename' => $rrd_filename,
|
||||||
|
'ds' => 'ipv6-questions',
|
||||||
|
'descr' => 'IPv6 Questions',
|
||||||
|
'area' => true,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'filename' => $rrd_filename,
|
||||||
|
'ds' => 'tcp-questions',
|
||||||
|
'descr' => 'TCP Questions',
|
||||||
|
'area' => true,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'filename' => $rrd_filename,
|
||||||
|
'ds' => 'over-capacity-drops',
|
||||||
|
'descr' => 'Over Capacity Drops',
|
||||||
|
'area' => true,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'filename' => $rrd_filename,
|
||||||
|
'ds' => 'policy-drops',
|
||||||
|
'descr' => 'Policy Drops',
|
||||||
|
'area' => true,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
echo "file missing: $rrd_filename";
|
||||||
|
}
|
||||||
|
|
||||||
|
require 'includes/graphs/generic_multi_line.inc.php';
|
@@ -1,5 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Outputs a stacked, filled line graph
|
||||||
|
*
|
||||||
|
* Variables:
|
||||||
|
* $rrd_list array required - array of data sets to graph. Each item is an array that contains the following
|
||||||
|
* ds string required - data set name as defined in rrd
|
||||||
|
* filename string required - path to the rrd file as generated by rrd_name()
|
||||||
|
* descr string required - the label for this data set
|
||||||
|
* colour string optional - Defines the colour for this data set (overrides the overall colour set)
|
||||||
|
* invert boolean optional - multiplies values in this data set by -1
|
||||||
|
* $colours string required - colour set as defined in $config['graph_colours']
|
||||||
|
* $print_total boolean optional - Sum all the values and output the last, min, max, and avg in the legend
|
||||||
|
* $simplerrd boolean optional - All data sets reside in the same rrd file
|
||||||
|
*/
|
||||||
|
|
||||||
require 'includes/graphs/common.inc.php';
|
require 'includes/graphs/common.inc.php';
|
||||||
|
|
||||||
if ($width > '500') {
|
if ($width > '500') {
|
||||||
@@ -29,20 +44,26 @@ else {
|
|||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$iter = 0;
|
$iter = 0;
|
||||||
|
$ids = array();
|
||||||
|
|
||||||
foreach ($rrd_list as $rrd) {
|
foreach ($rrd_list as $rrd) {
|
||||||
|
// get the color for this data set
|
||||||
|
if(isset($rrd['colour'])) {
|
||||||
|
$colour = $rrd['colour'];
|
||||||
|
} else {
|
||||||
if (!$config['graph_colours'][$colours][$iter]) {
|
if (!$config['graph_colours'][$colours][$iter]) {
|
||||||
$iter = 0;
|
$iter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$colour = $config['graph_colours'][$colours][$iter];
|
$colour = $config['graph_colours'][$colours][$iter];
|
||||||
|
$iter++;
|
||||||
|
}
|
||||||
|
|
||||||
$ds = $rrd['ds'];
|
$ds = $rrd['ds'];
|
||||||
$filename = $rrd['filename'];
|
$filename = $rrd['filename'];
|
||||||
|
|
||||||
$descr = rrdtool_escape($rrd['descr'], $descr_len);
|
$descr = rrdtool_escape($rrd['descr'], $descr_len);
|
||||||
|
|
||||||
$id = 'ds'.$i;
|
$ids[] = ($id = 'ds'.$i);
|
||||||
|
|
||||||
$rrd_options .= ' DEF:'.$id."=$filename:$ds:AVERAGE";
|
$rrd_options .= ' DEF:'.$id."=$filename:$ds:AVERAGE";
|
||||||
|
|
||||||
@@ -69,10 +90,26 @@ foreach ($rrd_list as $rrd) {
|
|||||||
$bstack = ':STACK';
|
$bstack = ':STACK';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
$iter++;
|
|
||||||
}//end foreach
|
}//end foreach
|
||||||
|
|
||||||
|
if ($print_total) {
|
||||||
|
$tot = $ids;
|
||||||
|
for ($i=1; $i<count($ids); $i++) {
|
||||||
|
$tot[] = '+';
|
||||||
|
}
|
||||||
|
|
||||||
|
$rrd_options .= ' CDEF:tot=' . implode($tot, ',');
|
||||||
|
$rrd_options .= ' COMMENT:" '.rrdtool_escape('Total', $descr_len).'"';
|
||||||
|
$rrd_options .= ' GPRINT:tot:LAST:%5.1lf%s';
|
||||||
|
$rrd_options .= ' GPRINT:tot:MIN:%5.1lf%s';
|
||||||
|
$rrd_options .= ' GPRINT:tot:MAX:%5.1lf%s';
|
||||||
|
$rrd_options .= ' GPRINT:tot:AVERAGE:%5.1lf%s\n';
|
||||||
|
}
|
||||||
|
|
||||||
$rrd_options .= $rrd_optionsb;
|
$rrd_options .= $rrd_optionsb;
|
||||||
$rrd_options .= ' HRULE:0#555555';
|
$rrd_options .= ' HRULE:0#555555';
|
||||||
$rrd_options .= $rrd_optionsc;
|
$rrd_options .= $rrd_optionsc;
|
||||||
|
@@ -1,5 +1,22 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Outputs a graph with multiple overlaid lines
|
||||||
|
*
|
||||||
|
* Variables:
|
||||||
|
* $rrd_list array required - array of data sets to graph. Each item is an array that contains the following
|
||||||
|
* ds string required - data set name as defined in rrd
|
||||||
|
* filename string required - path to the rrd file as generated by rrd_name()
|
||||||
|
* descr string required - the label for this data set
|
||||||
|
* colour string optional - Defines the colour for this data set (overrides the overall colour set)
|
||||||
|
* area boolean optional - Colors in the area of the data set with 20% opacity (unless areacolor is set)
|
||||||
|
* areacolor string optional - Sets the area color manually
|
||||||
|
* invert boolean optional - multiplies values in this data set by -1
|
||||||
|
* $colours string required - colour set as defined in $config['graph_colours']
|
||||||
|
* $print_total boolean optional - Sum all the values and output the last, min, max, and avg in the legend
|
||||||
|
* $simplerrd boolean optional - All data sets reside in the same rrd file
|
||||||
|
*/
|
||||||
|
|
||||||
require 'includes/graphs/common.inc.php';
|
require 'includes/graphs/common.inc.php';
|
||||||
|
|
||||||
if ($width > '500') {
|
if ($width > '500') {
|
||||||
@@ -31,11 +48,17 @@ $i = 0;
|
|||||||
$iter = 0;
|
$iter = 0;
|
||||||
|
|
||||||
foreach ($rrd_list as $rrd) {
|
foreach ($rrd_list as $rrd) {
|
||||||
|
// get the color for this data set
|
||||||
|
if(isset($rrd['colour'])) {
|
||||||
|
$colour = $rrd['colour'];
|
||||||
|
} else {
|
||||||
if (!$config['graph_colours'][$colours][$iter]) {
|
if (!$config['graph_colours'][$colours][$iter]) {
|
||||||
$iter = 0;
|
$iter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$colour = $config['graph_colours'][$colours][$iter];
|
$colour = $config['graph_colours'][$colours][$iter];
|
||||||
|
$iter++;
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($rrd['area']) && empty($rrd['areacolour'])) {
|
if (!empty($rrd['area']) && empty($rrd['areacolour'])) {
|
||||||
$rrd['areacolour'] = $colour."20";
|
$rrd['areacolour'] = $colour."20";
|
||||||
}
|
}
|
||||||
@@ -76,7 +99,6 @@ foreach ($rrd_list as $rrd) {
|
|||||||
$rrd_optionsb .= ' GPRINT:'.$id.'max:MAX:%5.2lf%s'.$units.' GPRINT:'.$id.":AVERAGE:'%5.2lf%s$units\\n'";
|
$rrd_optionsb .= ' GPRINT:'.$id.'max:MAX:%5.2lf%s'.$units.' GPRINT:'.$id.":AVERAGE:'%5.2lf%s$units\\n'";
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
$iter++;
|
|
||||||
}//end foreach
|
}//end foreach
|
||||||
|
|
||||||
$rrd_options .= $rrd_optionsb;
|
$rrd_options .= $rrd_optionsb;
|
||||||
|
@@ -33,6 +33,13 @@ $graphs['nginx'] = array(
|
|||||||
'req',
|
'req',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$graphs['powerdns-recursor'] = array(
|
||||||
|
'questions',
|
||||||
|
'answers',
|
||||||
|
'cache_performance',
|
||||||
|
'outqueries'
|
||||||
|
);
|
||||||
|
|
||||||
$graphs['rrdcached'] = array(
|
$graphs['rrdcached'] = array(
|
||||||
'queue_length',
|
'queue_length',
|
||||||
'events',
|
'events',
|
||||||
|
53
html/pages/device/apps/powerdns-recursor.inc.php
Normal file
53
html/pages/device/apps/powerdns-recursor.inc.php
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* powerdns-recursor.php
|
||||||
|
*
|
||||||
|
* Graphs for PowerDNS Recursor
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* @package LibreNMS
|
||||||
|
* @link http://librenms.org
|
||||||
|
* @copyright 2016 Tony Murray
|
||||||
|
* @author Tony Murray <murraytony@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
$graphs = array(
|
||||||
|
'powerdns-recursor_questions' => 'Questions',
|
||||||
|
'powerdns-recursor_answers' => 'Answers',
|
||||||
|
'powerdns-recursor_cache_performance' => 'Cache Performance',
|
||||||
|
'powerdns-recursor_cache_size' => 'Cache Size',
|
||||||
|
'powerdns-recursor_outqueries' => 'Outbound Queries',
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($graphs as $key => $text) {
|
||||||
|
$graph_array['height'] = '100';
|
||||||
|
$graph_array['width'] = '215';
|
||||||
|
$graph_array['to'] = $config['time']['now'];
|
||||||
|
$graph_array['id'] = $app['app_id'];
|
||||||
|
$graph_array['type'] = 'application_'.$key;
|
||||||
|
|
||||||
|
echo '<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h3 class="panel-title">'.$text.'</h3>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="row">';
|
||||||
|
include 'includes/print-graphrow.inc.php';
|
||||||
|
echo '</div>';
|
||||||
|
echo '</div>';
|
||||||
|
echo '</div>';
|
||||||
|
}
|
126
includes/polling/applications/powerdns-recursor.inc.php
Normal file
126
includes/polling/applications/powerdns-recursor.inc.php
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* powerdns-recursor.inc.php
|
||||||
|
*
|
||||||
|
* PowerDNS Recursor application polling module
|
||||||
|
* Capable of collecting stats from the agent or via direct connection
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* @package LibreNMS
|
||||||
|
* @link http://librenms.org
|
||||||
|
* @copyright 2016 Tony Murray
|
||||||
|
* @author Tony Murray <murraytony@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
echo ' powerdns-recrusor';
|
||||||
|
|
||||||
|
global $config;
|
||||||
|
$data = '';
|
||||||
|
|
||||||
|
$name = 'powerdns-recursor';
|
||||||
|
$app_id = $app['app_id'];
|
||||||
|
if ($agent_data['app'][$name]) {
|
||||||
|
$data = $agent_data['app'][$name];
|
||||||
|
} elseif (isset($config['apps'][$name]['api-key'])) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($data)) {
|
||||||
|
$rrd_def = array(
|
||||||
|
'all-outqueries' => 'DS:all-outqueries:COUNTER:600:0:U',
|
||||||
|
'answers-slow' => 'DS:answers-slow:COUNTER:600:0:U',
|
||||||
|
'answers0-1' => 'DS:answers0-1:COUNTER:600:0:U',
|
||||||
|
'answers1-10' => 'DS:answers1-10:COUNTER:600:0:U',
|
||||||
|
'answers10-100' => 'DS:answers10-100:COUNTER:600:0:U',
|
||||||
|
'answers100-1000' => 'DS:answers100-1000:COUNTER:600:0:U',
|
||||||
|
'cache-entries' => 'DS:cache-entries:GAUGE:600:0:U',
|
||||||
|
'cache-hits' => 'DS:cache-hits:COUNTER:600:0:U',
|
||||||
|
'cache-misses' => 'DS:cache-misses:COUNTER:600:0:U',
|
||||||
|
'case-mismatches' => 'DS:case-mismatches:COUNTER:600:0:U',
|
||||||
|
'chain-resends' => 'DS:chain-resends:COUNTER:600:0:U',
|
||||||
|
'client-parse-errors' => 'DS:client-parse-errors:COUNTER:600:0:U',
|
||||||
|
'concurrent-queries' => 'DS:concurrent-queries:GAUGE:600:0:U',
|
||||||
|
'dlg-only-drops' => 'DS:dlg-only-drops:COUNTER:600:0:U',
|
||||||
|
'dont-outqueries' => 'DS:dont-outqueries:COUNTER:600:0:U',
|
||||||
|
'edns-ping-matches' => 'DS:edns-ping-matches:COUNTER:600:0:U',
|
||||||
|
'edns-ping-mismatches' => 'DS:edns-ping-mismatches:COUNTER:600:0:U',
|
||||||
|
'failed-host-entries' => 'DS:failed-host-entries:GAUGE:600:0:U',
|
||||||
|
'ipv6-outqueries' => 'DS:ipv6-outqueries:COUNTER:600:0:U',
|
||||||
|
'ipv6-questions' => 'DS:ipv6-questions:COUNTER:600:0:U',
|
||||||
|
'malloc-bytes' => 'DS:malloc-bytes:GAUGE:600:0:U',
|
||||||
|
'max-mthread-stack' => 'DS:max-mthread-stack:GAUGE:600:0:U',
|
||||||
|
'negcache-entries' => 'DS:negcache-entries:GAUGE:600:0:U',
|
||||||
|
'no-packet-error' => 'DS:no-packet-error:COUNTER:600:0:U',
|
||||||
|
'noedns-outqueries' => 'DS:noedns-outqueries:COUNTER:600:0:U',
|
||||||
|
'noerror-answers' => 'DS:noerror-answers:COUNTER:600:0:U',
|
||||||
|
'noping-outqueries' => 'DS:noping-outqueries:COUNTER:600:0:U',
|
||||||
|
'nsset-invalidations' => 'DS:nsset-invalidations:COUNTER:600:0:U',
|
||||||
|
'nsspeeds-entries' => 'DS:nsspeeds-entries:GAUGE:600:0:U',
|
||||||
|
'nxdomain-answers' => 'DS:nxdomain-answers:COUNTER:600:0:U',
|
||||||
|
'outgoing-timeouts' => 'DS:outgoing-timeouts:COUNTER:600:0:U',
|
||||||
|
'over-capacity-drops' => 'DS:over-capacity-drops:COUNTER:600:0:U',
|
||||||
|
'packetcache-entries' => 'DS:packetcache-entries:GAUGE:600:0:U',
|
||||||
|
'packetcache-hits' => 'DS:packetcache-hits:COUNTER:600:0:U',
|
||||||
|
'packetcache-misses' => 'DS:packetcache-misses:COUNTER:600:0:U',
|
||||||
|
'policy-drops' => 'DS:policy-drops:COUNTER:600:0:U',
|
||||||
|
'qa-latency' => 'DS:qa-latency:GAUGE:600:0:U',
|
||||||
|
'questions' => 'DS:questions:COUNTER:600:0:U',
|
||||||
|
'resource-limits' => 'DS:resource-limits:COUNTER:600:0:U',
|
||||||
|
'security-status' => 'DS:security-status:GAUGE:600:0:U',
|
||||||
|
'server-parse-errors' => 'DS:server-parse-errors:COUNTER:600:0:U',
|
||||||
|
'servfail-answers' => 'DS:servfail-answers:COUNTER:600:0:U',
|
||||||
|
'spoof-prevents' => 'DS:spoof-prevents:COUNTER:600:0:U',
|
||||||
|
'sys-msec' => 'DS:sys-msec:COUNTER:600:0:U',
|
||||||
|
'tcp-client-overflow' => 'DS:tcp-client-overflow:COUNTER:600:0:U',
|
||||||
|
'tcp-clients' => 'DS:tcp-clients:GAUGE:600:0:U',
|
||||||
|
'tcp-outqueries' => 'DS:tcp-outqueries:COUNTER:600:0:U',
|
||||||
|
'tcp-questions' => 'DS:tcp-questions:COUNTER:600:0:U',
|
||||||
|
'throttle-entries' => 'DS:throttle-entries:GAUGE:600:0:U',
|
||||||
|
'throttled-out' => 'DS:throttled-out:COUNTER:600:0:U',
|
||||||
|
'throttled-outqueries' => 'DS:throttled-outquerie:COUNTER:600:0:U',
|
||||||
|
'too-old-drops' => 'DS:too-old-drops:COUNTER:600:0:U',
|
||||||
|
'unauthorized-tcp' => 'DS:unauthorized-tcp:COUNTER:600:0:U',
|
||||||
|
'unauthorized-udp' => 'DS:unauthorized-udp:COUNTER:600:0:U',
|
||||||
|
'unexpected-packets' => 'DS:unexpected-packets:COUNTER:600:0:U',
|
||||||
|
'unreachables' => 'DS:unreachables:COUNTER:600:0:U',
|
||||||
|
'uptime' => 'DS:uptime:COUNTER:600:0:U',
|
||||||
|
'user-msec' => 'DS:user-msec:COUNTER:600:0:U',
|
||||||
|
);
|
||||||
|
|
||||||
|
//decode and flatten the data
|
||||||
|
$stats = array();
|
||||||
|
foreach (json_decode($data, true) as $stat) {
|
||||||
|
$stats[$stat['name']] = $stat['value'];
|
||||||
|
}
|
||||||
|
d_echo($stats);
|
||||||
|
|
||||||
|
// only the stats we store in rrd
|
||||||
|
$fields = array();
|
||||||
|
foreach ($rrd_def as $key => $value) {
|
||||||
|
if (isset($stats[$key])) {
|
||||||
|
$fields[$key] = $stats[$key];
|
||||||
|
} else {
|
||||||
|
$fields[$key] = 'U';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$rrd_name = array('app', 'powerdns', 'recursor', $app_id);
|
||||||
|
$tags = compact('name', 'app_id', 'rrd_name', 'rrd_def');
|
||||||
|
data_update($device, 'app', $tags, $fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($data, $stats, $rrd_def, $rrd_name, $rrd_keys, $tags, $fields);
|
Reference in New Issue
Block a user