mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
PowerDNS application type. Thanks to Dennis de Houx.
git-svn-id: http://www.observium.org/svn/observer/trunk@2572 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
36
html/includes/graphs/application/powerdns_fail.inc.php
Normal file
36
html/includes/graphs/application/powerdns_fail.inc.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
$scale_min = 0;
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-powerdns-".$app['app_id'].".rrd";
|
||||
|
||||
|
||||
$array = array('corruptPackets' => array('descr' => 'Corrupt', 'colour' => 'FF8800FF'),
|
||||
'servfailPackets' => array('descr' => 'Failed', 'colour' => 'FF0000FF'),
|
||||
'q_timedout' => array('descr' => 'Timedout', 'colour' => 'FFFF00FF'),
|
||||
);
|
||||
|
||||
|
||||
$i = 0;
|
||||
if (is_file($rrd_filename))
|
||||
{
|
||||
foreach ($array as $ds => $vars)
|
||||
{
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $vars['descr'];
|
||||
$rrd_list[$i]['ds'] = $ds;
|
||||
$rrd_list[$i]['colour'] = $vars['colour'];
|
||||
$i++;
|
||||
}
|
||||
} else { echo("file missing: $file"); }
|
||||
|
||||
$colours = "red";
|
||||
$nototal = 0;
|
||||
$unit_text = "Packets/sec";
|
||||
|
||||
include("includes/graphs/generic_multi_simplex_seperated.inc.php");
|
||||
|
||||
|
||||
?>
|
27
html/includes/graphs/application/powerdns_latency.inc.php
Normal file
27
html/includes/graphs/application/powerdns_latency.inc.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
$scale_min = 0;
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
$powerdns_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-powerdns-".$app['app_id'].".rrd";
|
||||
|
||||
if (is_file($powerdns_rrd))
|
||||
{
|
||||
$rrd_filename = $powerdns_rrd;
|
||||
}
|
||||
|
||||
$ds = "latency";
|
||||
|
||||
$colour_area = "6699FF";
|
||||
$colour_line = "336699";
|
||||
|
||||
$colour_area_max = "FFEE99";
|
||||
|
||||
$graph_max = 100;
|
||||
|
||||
$unit_text = "Latency";
|
||||
|
||||
include("includes/graphs/generic_simplex.inc.php");
|
||||
|
||||
?>
|
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
$scale_min = 0;
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-powerdns-".$app['app_id'].".rrd";
|
||||
|
||||
|
||||
$array = array('pc_hit' => array('descr' => 'Hits', 'colour' => '008800FF'),
|
||||
'pc_miss' => array('descr' => 'Misses', 'colour' => '880000FF'),
|
||||
'pc_size' => array('descr' => 'Size', 'colour' => '006699FF'),
|
||||
);
|
||||
|
||||
|
||||
$i = 0;
|
||||
if (is_file($rrd_filename))
|
||||
{
|
||||
foreach ($array as $ds => $vars)
|
||||
{
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $vars['descr'];
|
||||
$rrd_list[$i]['ds'] = $ds;
|
||||
$rrd_list[$i]['colour'] = $vars['colour'];
|
||||
$i++;
|
||||
}
|
||||
} else { echo("file missing: $file"); }
|
||||
|
||||
$colours = "blue";
|
||||
$nototal = 0;
|
||||
$unit_text = "Packets/sec";
|
||||
|
||||
include("includes/graphs/generic_multi_simplex_seperated.inc.php");
|
||||
|
||||
|
||||
?>
|
37
html/includes/graphs/application/powerdns_queries.inc.php
Normal file
37
html/includes/graphs/application/powerdns_queries.inc.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
$scale_min = 0;
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-powerdns-".$app['app_id'].".rrd";
|
||||
|
||||
|
||||
$array = array('q_tcpAnswers' => array('descr' => 'TCP Answers', 'colour' => '008800FF'),
|
||||
'q_tcpQueries' => array('descr' => 'TCP Queries', 'colour' => '00FF00FF'),
|
||||
'q_udpAnswers' => array('descr' => 'UDP Answers', 'colour' => '336699FF'),
|
||||
'q_udpQueries' => array('descr' => 'UDP Queries', 'colour' => '6699CCFF'),
|
||||
);
|
||||
|
||||
|
||||
$i = 0;
|
||||
if (is_file($rrd_filename))
|
||||
{
|
||||
foreach ($array as $ds => $vars)
|
||||
{
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $vars['descr'];
|
||||
$rrd_list[$i]['ds'] = $ds;
|
||||
$rrd_list[$i]['colour'] = $vars['colour'];
|
||||
$i++;
|
||||
}
|
||||
} else { echo("file missing: $file"); }
|
||||
|
||||
$colours = "mixed";
|
||||
$nototal = 0;
|
||||
$unit_text = "Packets/sec";
|
||||
|
||||
include("includes/graphs/generic_multi_simplex_seperated.inc.php");
|
||||
|
||||
|
||||
?>
|
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
$scale_min = 0;
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-powerdns-".$app['app_id'].".rrd";
|
||||
|
||||
|
||||
$array = array('q_udp4Answers' => array('descr' => 'UDP4 Answers\t', 'colour' => '00008888'),
|
||||
'q_udp4Queries' => array('descr' => 'UDP4 Queries ', 'colour' => '000088FF'),
|
||||
'q_udp6Answers' => array('descr' => 'UDP6 Answers ', 'colour' => '88000088'),
|
||||
'q_udp6Queries' => array('descr' => 'UDP6 Queries ', 'colour' => '880000FF'),
|
||||
);
|
||||
|
||||
|
||||
$i = 0;
|
||||
if (is_file($rrd_filename))
|
||||
{
|
||||
foreach ($array as $ds => $vars)
|
||||
{
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $vars['descr'];
|
||||
$rrd_list[$i]['ds'] = $ds;
|
||||
$rrd_list[$i]['colour'] = $vars['colour'];
|
||||
$i++;
|
||||
}
|
||||
} else { echo("file missing: $file"); }
|
||||
|
||||
$colours = "mixed";
|
||||
$nototal = 0;
|
||||
$unit_text = "Packets/sec";
|
||||
|
||||
include("includes/graphs/generic_multi_simplex_seperated.inc.php");
|
||||
|
||||
|
||||
?>
|
36
html/includes/graphs/application/powerdns_querycache.inc.php
Normal file
36
html/includes/graphs/application/powerdns_querycache.inc.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
$scale_min = 0;
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-powerdns-".$app['app_id'].".rrd";
|
||||
|
||||
|
||||
$array = array('qc_miss' => array('descr' => 'Misses', 'colour' => '750F7DFF'),
|
||||
'qc_hit' => array('descr' => 'Hits', 'colour' => '00FF00FF'),
|
||||
);
|
||||
|
||||
|
||||
$i = 0;
|
||||
if (is_file($rrd_filename))
|
||||
{
|
||||
foreach ($array as $ds => $vars)
|
||||
{
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $vars['descr'];
|
||||
$rrd_list[$i]['ds'] = $ds;
|
||||
$rrd_list[$i]['colour'] = $vars['colour'];
|
||||
$i++;
|
||||
}
|
||||
} else { echo("file missing: $file"); }
|
||||
|
||||
$colours = "mixed";
|
||||
$nototal = 0;
|
||||
$unit_text = "Packets/sec";
|
||||
|
||||
//include("includes/graphs/generic_multi_simplex_seperated.inc.php");
|
||||
include("includes/graphs/generic_multi_line.inc.php");
|
||||
|
||||
|
||||
?>
|
36
html/includes/graphs/application/powerdns_recursing.inc.php
Normal file
36
html/includes/graphs/application/powerdns_recursing.inc.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
$scale_min = 0;
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-powerdns-".$app['app_id'].".rrd";
|
||||
|
||||
|
||||
$array = array('rec_questions' => array('descr' => 'Questions', 'colour' => '6699CCFF'),
|
||||
'rec_answers' => array('descr' => 'Answers', 'colour' => '336699FF'),
|
||||
);
|
||||
|
||||
|
||||
$i = 0;
|
||||
if (is_file($rrd_filename))
|
||||
{
|
||||
foreach ($array as $ds => $vars)
|
||||
{
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $vars['descr'];
|
||||
$rrd_list[$i]['ds'] = $ds;
|
||||
$rrd_list[$i]['colour'] = $vars['colour'];
|
||||
$i++;
|
||||
}
|
||||
} else { echo("file missing: $file"); }
|
||||
|
||||
$colours = "mixed";
|
||||
$nototal = 0;
|
||||
$unit_text = "Packets/sec";
|
||||
|
||||
//include("includes/graphs/generic_multi_simplex_seperated.inc.php");
|
||||
include("includes/graphs/generic_multi_line.inc.php");
|
||||
|
||||
|
||||
?>
|
30
html/pages/device/apps/powerdns.inc.php
Normal file
30
html/pages/device/apps/powerdns.inc.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
global $config;
|
||||
|
||||
$graphs = array('powerdns_latency' => 'Latency',
|
||||
'powerdns_fail' => 'Corrupt - Failed - Timedout',
|
||||
'powerdns_packetcache' => 'Packet Cache',
|
||||
'powerdns_querycache' => 'Query Cache',
|
||||
'powerdns_recursing' => 'Recursing Queries and Answers',
|
||||
'powerdns_queries' => 'Total UDP/TCP Queries and Answers',
|
||||
'powerdns_queries_udp' => 'Detail UDP IPv4/IPv6 Queries and Answers');
|
||||
|
||||
foreach ($graphs as $key => $text) {
|
||||
$graph_type = $key;
|
||||
$graph_array['height'] = "100";
|
||||
$graph_array['width'] = "215";
|
||||
$graph_array['to'] = $now;
|
||||
$graph_array['id'] = $app['app_id'];
|
||||
$graph_array['type'] = "application_".$key;
|
||||
|
||||
echo('<h3>'.$text.'</h3>');
|
||||
|
||||
echo("<tr bgcolor='$row_colour'><td colspan=5>");
|
||||
|
||||
include("includes/print-quadgraphs.inc.php");
|
||||
|
||||
echo("</td></tr>");
|
||||
}
|
||||
|
||||
?>
|
55
includes/polling/applications/powerdns.inc.php
Normal file
55
includes/polling/applications/powerdns.inc.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
## Polls powerdns statistics from script via SNMP
|
||||
|
||||
$powerdns_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-powerdns-".$app['app_id'].".rrd";
|
||||
$powerdns_cmd = $config['snmpget'] ." -m NET-SNMP-EXTEND-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
|
||||
$powerdns_cmd .= " nsExtendOutputFull.8.112.111.119.101.114.100.110.115";
|
||||
$powerdns = shell_exec($powerdns_cmd);
|
||||
echo(" powerdns");
|
||||
list ($corrupt, $def_cacheInserts, $def_cacheLookup, $latency, $pc_hit, $pc_miss, $pc_size, $qsize, $qc_hit,
|
||||
$qc_miss, $rec_answers, $rec_questions, $servfail, $tcp_answers, $tcp_queries, $timedout,
|
||||
$udp_answers, $udp_queries, $udp4_answers, $udp4_queries, $udp6_answers, $udp6_queries) = explode("\n", $powerdns);
|
||||
|
||||
if (!is_file($powerdns_rrd))
|
||||
{
|
||||
rrdtool_create($powerdns_rrd, "--step 300 \
|
||||
DS:corruptPackets:DERIVE:600:0:125000000000 \
|
||||
DS:def_cacheInserts:DERIVE:600:0:125000000000 \
|
||||
DS:def_cacheLookup:DERIVE:600:0:125000000000 \
|
||||
DS:latency:DERIVE:600:0:125000000000 \
|
||||
DS:pc_hit:DERIVE:600:0:125000000000 \
|
||||
DS:pc_miss:DERIVE:600:0:125000000000 \
|
||||
DS:pc_size:DERIVE:600:0:125000000000 \
|
||||
DS:qsize:DERIVE:600:0:125000000000 \
|
||||
DS:qc_hit:DERIVE:600:0:125000000000 \
|
||||
DS:qc_miss:DERIVE:600:0:125000000000 \
|
||||
DS:rec_answers:DERIVE:600:0:125000000000 \
|
||||
DS:rec_questions:DERIVE:600:0:125000000000 \
|
||||
DS:servfailPackets:DERIVE:600:0:125000000000 \
|
||||
DS:q_tcpAnswers:DERIVE:600:0:125000000000 \
|
||||
DS:q_tcpQueries:DERIVE:600:0:125000000000 \
|
||||
DS:q_timedout:DERIVE:600:0:125000000000 \
|
||||
DS:q_udpAnswers:DERIVE:600:0:125000000000 \
|
||||
DS:q_udpQueries:DERIVE:600:0:125000000000 \
|
||||
DS:q_udp4Answers:DERIVE:600:0:125000000000 \
|
||||
DS:q_udp4Queries:DERIVE:600:0:125000000000 \
|
||||
DS:q_udp6Answers:DERIVE:600:0:125000000000 \
|
||||
DS:q_udp6Queries:DERIVE:600:0:125000000000 \
|
||||
RRA:AVERAGE:0.5:1:600 \
|
||||
RRA:AVERAGE:0.5:6:700 \
|
||||
RRA:AVERAGE:0.5:24:775 \
|
||||
RRA:AVERAGE:0.5:288:797 \
|
||||
RRA:MIN:0.5:1:600 \
|
||||
RRA:MIN:0.5:6:700 \
|
||||
RRA:MIN:0.5:24:775 \
|
||||
RRA:MIN:0.5:288:797 \
|
||||
RRA:MAX:0.5:1:600 \
|
||||
RRA:MAX:0.5:6:700 \
|
||||
RRA:MAX:0.5:24:775 \
|
||||
RRA:MAX:0.5:288:797");
|
||||
}
|
||||
|
||||
rrdtool_update($powerdns_rrd, "N:$corrupt:$def_cacheInserts:$def_cacheLookup:$latency:$pc_hit:$pc_miss:$pc_size:$qsize:$qc_hit:$qc_miss:$rec_answers:$rec_questions:$servfail:$tcp_answers:$tcp_queries:$timedout:$udp_answers:$udp_queries:$udp4_answers:$udp4_queries:$udp6_answers:$udp6_queries");
|
||||
|
||||
?>
|
83
scripts/powerdns.php
Executable file
83
scripts/powerdns.php
Executable file
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
########################################################################################
|
||||
##
|
||||
## A small script to grab the DNS statistics from a PowerDNS server
|
||||
## Needed commands: php, pdns_control
|
||||
##
|
||||
## Install:
|
||||
## Add the following to your snmpd.conf file:
|
||||
## extend powerdns /opt/observium/scripts/powerdns.php
|
||||
##
|
||||
## Version 1.0 By:
|
||||
## All In One - Dennis de Houx <info@all-in-one.be>
|
||||
##
|
||||
########################################################################################
|
||||
|
||||
|
||||
#### START SETTINGS ####
|
||||
|
||||
$pdnscontrol = "/usr/bin/pdns_control";
|
||||
|
||||
#### END SETTINGS ####
|
||||
|
||||
|
||||
##
|
||||
## DO NOT EDIT BENETH THIS LINE
|
||||
##
|
||||
########################################################################################
|
||||
|
||||
$cmd = shell_exec($pdnscontrol." show \*");
|
||||
$vars = array();
|
||||
$vars = explode(',', $cmd);
|
||||
|
||||
function doSNMP($vars) {
|
||||
foreach ($vars as $item=>$value) {
|
||||
$value = trim($value);
|
||||
if (!empty($value)) {
|
||||
echo $value."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function doSNMPv2($vars) {
|
||||
$pdns = array();
|
||||
foreach ($vars as $item=>$value) {
|
||||
if (!empty($value)) {
|
||||
$temp = explode('=', $value);
|
||||
if (isset($temp[1])) {
|
||||
$pdns[$temp[0]] = $temp[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
$var['corrupt-packets'] = (isset($pdns['corrupt-packets']) ? $pdns['corrupt-packets'] : "U");
|
||||
$var['deferred-cache-inserts'] = (isset($pdns['deferred-cache-inserts']) ? $pdns['deferred-cache-inserts'] : "U");
|
||||
$var['deferred-cache-lookup'] = (isset($pdns['deferred-cache-lookup']) ? $pdns['deferred-cache-lookup'] : "U");
|
||||
$var['latency'] = (isset($pdns['latency']) ? $pdns['latency'] : "U");
|
||||
$var['packetcache-hit'] = (isset($pdns['packetcache-hit']) ? $pdns['packetcache-hit'] : "U");
|
||||
$var['packetcache-miss'] = (isset($pdns['packetcache-miss']) ? $pdns['packetcache-miss'] : "U");
|
||||
$var['packetcache-size'] = (isset($pdns['packetcache-size']) ? $pdns['packetcache-size'] : "U");
|
||||
$var['qsize-q'] = (isset($pdns['qsize-q']) ? $pdns['qsize-q'] : "U");
|
||||
$var['query-cache-hit'] = (isset($pdns['query-cache-hit']) ? $pdns['query-cache-hit'] : "U");
|
||||
$var['query-cache-miss'] = (isset($pdns['query-cache-miss']) ? $pdns['query-cache-miss'] : "U");
|
||||
$var['recursing-answers'] = (isset($pdns['recursing-answers']) ? $pdns['recursing-answers'] : "U");
|
||||
$var['recursing-questions'] = (isset($pdns['recursing-questions']) ? $pdns['recursing-questions'] : "U");
|
||||
$var['servfail-packets'] = (isset($pdns['servfail-packets']) ? $pdns['servfail-packets'] : "U");
|
||||
$var['tcp-answers'] = (isset($pdns['tcp-answers']) ? $pdns['tcp-answers'] : "U");
|
||||
$var['tcp-queries'] = (isset($pdns['tcp-queries']) ? $pdns['tcp-queries'] : "U");
|
||||
$var['timedout-packets'] = (isset($pdns['timedout-packets']) ? $pdns['timedout-packets'] : "U");
|
||||
$var['udp-answers'] = (isset($pdns['udp-answers']) ? $pdns['udp-answers'] : "U");
|
||||
$var['udp-queries'] = (isset($pdns['udp-queries']) ? $pdns['udp-queries'] : "U");
|
||||
$var['udp4-answers'] = (isset($pdns['udp4-answers']) ? $pdns['udp4-answers'] : "U");
|
||||
$var['udp4-queries'] = (isset($pdns['udp4-queries']) ? $pdns['udp4-queries'] : "U");
|
||||
$var['udp6-answers'] = (isset($pdns['udp6-answers']) ? $pdns['udp6-answers'] : "U");
|
||||
$var['udp6-queries'] = (isset($pdns['udp6-queries']) ? $pdns['udp6-queries'] : "U");
|
||||
foreach ($var as $item=>$count) {
|
||||
echo $count."\n";
|
||||
}
|
||||
}
|
||||
|
||||
doSNMPv2($vars);
|
||||
|
||||
?>
|
Reference in New Issue
Block a user