feature: Added additional Unbound chart for query cache info (#6574)

* Update unbound.inc.php

* Update unbound.inc.php

* Create unbound_cache.inc.php

* Update AUTHORS.md

* Update apps.inc.php
This commit is contained in:
Slashdoom
2017-05-04 22:04:10 +12:00
committed by Neil Lathwood
parent 418d2c8fef
commit bdf1616c76
5 changed files with 48 additions and 1 deletions

View File

@@ -204,6 +204,7 @@ LibreNMS contributors:
- Svenn D'Hert <admin at svennd.be> (svennd)
- Dominik Bay <db@rrbone.net> (eimann)
- Nick Peelman <nick@peelman.us> (peelman)
- Patrick Ryon <patrick@slashdoom.com> (slashdoom)
Observium was written by:
- Adam Armstrong

View File

@@ -0,0 +1,30 @@
<?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-cache', $app['app_id']));
$array = array(
'queries',
'hits',
'misses'
);
$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';

View File

@@ -226,6 +226,7 @@ $graphs['fbsd-nfs-client'] = array(
$graphs['unbound'] = array(
'queries',
'cache',
);
$graphs['bind'] = array(

View File

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

View File

@@ -62,4 +62,18 @@ $fields = array (
);
$tags = compact('name', 'app_id', 'rrd_name', 'rrd_def');
data_update($device, 'app', $tags, $fields);
#Unbound Cache
$rrd_name = array('app', $name,'cache',$app_id);
$rrd_def = RrdDefinition::make()
->addDataset('queries', 'DERIVE', 0, 125000000000)
->addDataset('hits', 'DERIVE', 0, 125000000000)
->addDataset('misses', 'DERIVE', 0, 125000000000);
$fields = array (
'queries' => $unbound['total.num.queries'],
'hits' => $unbound['total.num.cachehits'],
'misses' => $unbound['total.num.cachemiss']
);
$tags = compact('name', 'app_id', 'rrd_name', 'rrd_def');
data_update($device, 'app', $tags, $fields);
unset($lines , $unbound, $rrd_name, $rrd_def, $fields, $tags);