mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Extended unbound monitoring (#11255)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
require 'includes/html/graphs/common.inc.php';
|
||||
|
||||
$i = 0;
|
||||
$scale_min = 0;
|
||||
$nototal = 1;
|
||||
$unit_text = 'Time in ms';
|
||||
$rrd_filename = rrd_name($device['hostname'], array('app', 'unbound-recursiontime', $app['app_id']));
|
||||
$array = array(
|
||||
'avg',
|
||||
'median',
|
||||
);
|
||||
|
||||
$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/html/graphs/generic_multi_line.inc.php';
|
30
includes/html/graphs/application/unbound_requestlist.inc.php
Normal file
30
includes/html/graphs/application/unbound_requestlist.inc.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
require 'includes/html/graphs/common.inc.php';
|
||||
|
||||
$i = 0;
|
||||
$scale_min = 0;
|
||||
$nototal = 1;
|
||||
$unit_text = 'Query/s';
|
||||
$rrd_filename = rrd_name($device['hostname'], array('app', 'unbound-requestlist', $app['app_id']));
|
||||
$array = array(
|
||||
'max',
|
||||
'overwritten',
|
||||
'exceeded',
|
||||
);
|
||||
|
||||
$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/html/graphs/generic_multi_line.inc.php';
|
@@ -3,7 +3,9 @@
|
||||
$graphs = array(
|
||||
'unbound_queries' => 'Unbound - Queries',
|
||||
'unbound_cache' => 'Unbound - Cache',
|
||||
'unbound_operations' => 'Unbound - Operations'
|
||||
'unbound_operations' => 'Unbound - Operations',
|
||||
'unbound_requestlist' => 'Unbound - Request list',
|
||||
'unbound_recursiontime' => 'Unbound - Recursion time'
|
||||
);
|
||||
foreach ($graphs as $key => $text) {
|
||||
$graph_type = $key;
|
||||
|
@@ -94,6 +94,34 @@ $metrics['operations'] = $fields;
|
||||
$tags = compact('name', 'app_id', 'rrd_name', 'rrd_def');
|
||||
data_update($device, 'app', $tags, $fields);
|
||||
|
||||
#Unbound requestlist
|
||||
$rrd_name = array('app', $name,'requestlist',$app_id);
|
||||
$rrd_def = RrdDefinition::make()
|
||||
->addDataset('max', 'DERIVE', 0, 125000000000)
|
||||
->addDataset('overwritten', 'DERIVE', 0, 125000000000)
|
||||
->addDataset('exceeded', 'DERIVE', 0, 125000000000);
|
||||
$fields = array (
|
||||
'max' => $unbound['total.requestlist.max'],
|
||||
'overwritten' => $unbound['total.requestlist.overwritten'],
|
||||
'exceeded' => $unbound['total.requestlist.exceeded']
|
||||
);
|
||||
$metrics['requestlist'] = $fields;
|
||||
$tags = compact('name', 'app_id', 'rrd_name', 'rrd_def');
|
||||
data_update($device, 'app', $tags, $fields);
|
||||
|
||||
#Unbound recursiontime
|
||||
$rrd_name = array('app', $name,'recursiontime',$app_id);
|
||||
$rrd_def = RrdDefinition::make()
|
||||
->addDataset('avg', 'GAUGE', 0, 125000000000)
|
||||
->addDataset('median', 'GAUGE', 0, 125000000000);
|
||||
$fields = array (
|
||||
'avg' => $unbound['total.recursion.time.avg'],
|
||||
'median' => $unbound['total.recursion.time.median']
|
||||
);
|
||||
$metrics['recursiontime'] = $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);
|
||||
|
Reference in New Issue
Block a user