feature: Added a third graph to unbound with more metrics (#8616)

* Added a third graph to unbound with more metrics

* Update unbound.inc.php

* Reset composer.lock

* Update unbound.inc.php

* Update unbound.inc.php
This commit is contained in:
Hans Erasmus
2018-04-25 21:52:12 +02:00
committed by Neil Lathwood
parent 492a973e2d
commit 163c595494
4 changed files with 51 additions and 49 deletions

View File

@@ -0,0 +1,31 @@
<?php
require 'includes/graphs/common.inc.php';
$i = 0;
$scale_min = 0;
$nototal = 1;
$unit_text = 'Query/s';
$rrd_filename = rrd_name($device['hostname'], array('app', 'unbound-operations', $app['app_id']));
$array = array(
'opcodeQuery',
'rcodeNOERROR',
'rcodeNXDOMAIN',
'rcodeNodata'
);
$colours = 'mixed';
$rrd_list = array();
if (rrdtool_check_rrd_exists($rrd_filename)) {
foreach ($array as $ds) {
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = strtoupper($ds);
$rrd_list[$i]['ds'] = $ds;
$i++;
}
} else {
echo "file missing: $rrd_filename";
}
require 'includes/graphs/generic_multi_line.inc.php';

49
html/pages/apps.inc.php Executable file → Normal file
View File

@@ -1,43 +1,36 @@
<?php
$pagetitle[] = 'Apps';
$graphs['apache'] = array(
'bits',
'hits',
'scoreboard',
'cpu',
);
$graphs['drbd'] = array(
'disk_bits',
'network_bits',
'queue',
'unsynced',
);
$graphs['entropy'] = array(
'entropy',
);
$graphs['mysql'] = array(
'network_traffic',
'connections',
'command_counters',
'select_types',
);
$graphs['memcached'] = array(
'bits',
'commands',
'data',
'items',
);
$graphs['nginx'] = array(
'connections',
'req',
);
$graphs['postfix'] = array(
'messages',
'qstats',
@@ -46,30 +39,25 @@ $graphs['postfix'] = array(
'deferral',
'rejects',
);
$graphs['powerdns-recursor'] = array(
'questions',
'answers',
'cache_performance',
'outqueries'
);
$graphs['rrdcached'] = array(
'queue_length',
'events',
'tree',
'journal'
);
$graphs['bind'] = array('queries');
$graphs['tinydns'] = array(
'queries',
'errors',
'dnssec',
'other',
);
$graphs['postgres'] = array(
'backends',
'cr',
@@ -78,7 +66,6 @@ $graphs['postgres'] = array(
'index',
'sequential'
);
$graphs['powerdns'] = array(
'latency',
'fail',
@@ -88,12 +75,10 @@ $graphs['powerdns'] = array(
'queries',
'queries_udp',
);
$graphs['ntp-client'] = array(
'stats',
'freq',
);
$graphs['ntp-server'] = array(
'stats',
'freq',
@@ -103,7 +88,6 @@ $graphs['ntp-server'] = array(
'packets',
'uptime',
);
$graphs['nfs-v3-stats'] = array(
'stats',
'io',
@@ -113,25 +97,20 @@ $graphs['nfs-v3-stats'] = array(
'net',
'rpc',
);
$graphs['nfs-server'] = array(
'io',
'net_tcp_conns',
'rpc',
);
$graphs['os-updates'] = array(
'packages',
);
$graphs['dhcp-stats'] = array(
'stats',
);
$graphs['fail2ban'] = array(
'banned',
);
$graphs['freeswitch'] = array(
'peak',
'calls',
@@ -139,7 +118,6 @@ $graphs['freeswitch'] = array(
'callsIn',
'callsOut',
);
$graphs['ups-nut'] = array(
'remaining',
'load',
@@ -147,7 +125,6 @@ $graphs['ups-nut'] = array(
'charge',
'voltage_input',
);
$graphs['ups-apcups'] = array(
'remaining',
'load',
@@ -155,22 +132,18 @@ $graphs['ups-apcups'] = array(
'charge',
'voltage_input',
);
$graphs['gpsd'] = array(
'satellites',
'dop',
'mode',
);
$graphs['exim-stats'] = array(
'frozen',
'queue'
);
$graphs['php-fpm'] = array(
'stats'
);
$graphs['nvidia'] = array(
'sm',
'mem',
@@ -189,7 +162,6 @@ $graphs['nvidia'] = array(
'sbecc',
'dbecc',
);
$graphs['squid'] = array(
'memory',
'clients',
@@ -206,28 +178,24 @@ $graphs['squid'] = array(
'pagefaults',
'cputime',
);
$graphs['opengridscheduler'] = array(
'ogs'
);
$graphs['fbsd-nfs-server'] = array(
'stats',
'cache',
'gathering',
);
$graphs['fbsd-nfs-client'] = array(
'stats',
'cache',
'rpc',
);
$graphs['unbound'] = array(
'queries',
'cache',
'operations',
);
$graphs['bind'] = array(
'incoming',
'outgoing',
@@ -245,7 +213,6 @@ $graphs['bind'] = array(
'sockets_active',
'sockets_errors',
);
$graphs['smart'] = array(
'id5',
'id10',
@@ -263,13 +230,11 @@ $graphs['smart'] = array(
'id231',
'id233',
);
$graphs['sdfsinfo'] = array(
'volume',
'blocks',
'rates',
);
$graphs['pi-hole'] = array(
'query_types',
'destinations',
@@ -277,7 +242,6 @@ $graphs['pi-hole'] = array(
'block_percent',
'blocklist',
);
$graphs['freeradius'] = array(
'access',
'auth',
@@ -287,7 +251,6 @@ $graphs['freeradius'] = array(
'proxy_acct',
'queue',
);
$graphs['zfs'] = array(
'arc_misc',
'arc_size',
@@ -300,7 +263,6 @@ $graphs['zfs'] = array(
'arc_cache_hits',
'arc_cache_miss',
);
$graphs['powerdns-dnsdist'] = array(
'cache',
'downstream',
@@ -311,35 +273,26 @@ $graphs['powerdns-dnsdist'] = array(
'rules_stats',
'queries_drop',
);
echo '<div class="panel panel-default">';
echo '<div class="panel-heading">';
echo "<span style='font-weight: bold;'>Apps</span> &#187; ";
unset($sep);
$link_array = array(
'page' => 'device',
'device' => $device['device_id'],
'tab' => 'apps',
);
foreach ($app_list as $app) {
echo $sep;
if ($vars['app'] == $app['app_type']) {
echo "<span class='pagemenu-selected'>";
}
echo generate_link(nicecase($app['app_type']), array('page' => 'apps', 'app' => $app['app_type']));
if ($vars['app'] == $app['app_type']) {
echo '</span>';
}
$sep = ' | ';
}
echo '</div>';
echo '<div class="panel-body">';
if ($vars['app']) {

View File

@@ -4,7 +4,8 @@ global $config;
$graphs = array(
'unbound_queries' => 'Unbound - Queries',
'unbound_cache' => 'Unbound - Cache'
'unbound_cache' => 'Unbound - Cache',
'unbound_operations' => 'Unbound - Operations'
);
foreach ($graphs as $key => $text) {
$graph_type = $key;

View File

@@ -77,6 +77,23 @@ $fields = array (
$metrics['cache'] = $fields;
$tags = compact('name', 'app_id', 'rrd_name', 'rrd_def');
data_update($device, 'app', $tags, $fields);
#Unbound Operations - Total opcodes and three valuable return codes
$rrd_name = array('app', $name,'operations',$app_id);
$rrd_def = RrdDefinition::make()
->addDataset('opcodeQuery', 'DERIVE', 0, 125000000000)
->addDataset('rcodeNOERROR', 'DERIVE', 0, 125000000000)
->addDataset('rcodeNXDOMAIN', 'DERIVE', 0, 125000000000)
->addDataset('rcodeNodata', 'DERIVE', 0, 125000000000);
$fields = array (
'opcodeQuery' => $unbound['num.query.opcode.QUERY'],
'rcodeNOERROR' => $unbound['num.answer.rcode.NOERROR'],
'rcodeNXDOMAIN' => $unbound['num.answer.rcode.NXDOMAIN'],
'rcodeNodata' => $unbound['num.answer.rcode.nodata']
);
$metrics['operations'] = $fields;
$tags = compact('name', 'app_id', 'rrd_name', 'rrd_def');
data_update($device, 'app', $tags, $fields);
update_application($app, $rawdata, $metrics);
unset($lines, $unbound, $rrd_name, $rrd_def, $fields, $tags);