mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-17 00:14:54 +02:00
Merge remote-tracking branch 'refs/remotes/librenms/master' into issue280
This commit is contained in:
@@ -82,6 +82,7 @@ LibreNMS contributors:
|
||||
- Adam Winberg <adam.winberg@gmail.com> (wiad)
|
||||
- Maximilian Wilhelm <max@rfc2324.org> (BarbarossaTM)
|
||||
- Jameson Finney <jameson.finney@gmail.com> (JamesonFinney)
|
||||
- John Wells <john.wells@greatworx.com> (jbwiv)
|
||||
|
||||
[1]: http://observium.org/ "Observium web site"
|
||||
Observium was written by:
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
* LibreNMS per-module poller performance
|
||||
*
|
||||
* Copyright (c) 2016 Mike Rostermund <mike@kollegienet.dk>
|
||||
* Copyright (c) 2016 Paul D. Gear <paul@librenms.org>
|
||||
*
|
||||
* 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
|
||||
@@ -11,28 +13,28 @@
|
||||
*/
|
||||
|
||||
$scale_min = '0';
|
||||
$colour_scheme = 'mixed';
|
||||
$attribs = get_dev_attribs($device['device_id']);
|
||||
ksort($config['poller_modules']);
|
||||
|
||||
require 'includes/graphs/common.inc.php';
|
||||
|
||||
$colour_iter = 0;
|
||||
$rrd_options .= " 'COMMENT:Seconds Current Minimum Maximum Average\\n'";
|
||||
$count = 0;
|
||||
foreach ($config['poller_modules'] as $module => $module_status) {
|
||||
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/poller-'.$module.'-perf.rrd';
|
||||
$rrd_filename = rrd_name($device['hostname'], array('poller-perf', $module));
|
||||
if ($attribs['poll_'.$module] || ( $module_status && !isset($attribs['poll_'.$module]))) {
|
||||
if (is_file($rrd_filename)) {
|
||||
if (!$config['graph_colours'][$colour_scheme][$colour_iter]) {
|
||||
$colour_iter = 0;
|
||||
}
|
||||
$colour = $config['graph_colours'][$colour_scheme][$colour_iter];
|
||||
$colour_iter++;
|
||||
|
||||
$rrd_options .= ' DEF:'.$module.'='.$rrd_filename.':'.$module.':AVERAGE';
|
||||
$rrd_options .= ' LINE1.25:'.$module.'#'.$colour.':"'.str_pad($module, 18," ").'"';
|
||||
$rrd_options .= ' GPRINT:'.$module.':LAST:%6.2lf GPRINT:'.$module.':AVERAGE:%7.2lf';
|
||||
$rrd_options .= " GPRINT:".$module.":MAX:%7.2lf 'GPRINT:".$module.":AVERAGE:%7.2lf\\n'";
|
||||
$ds['ds'] = 'poller';
|
||||
$ds['descr'] = $module;
|
||||
$ds['filename'] = $rrd_filename;
|
||||
$rrd_list[] = $ds;
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$unit_text = "Seconds";
|
||||
$simple_rrd = false;
|
||||
$nototal = false;
|
||||
$text_orig = true;
|
||||
$colours = 'manycolours';
|
||||
require "includes/graphs/generic_multi_simplex_seperated.inc.php";
|
||||
|
||||
@@ -13,7 +13,14 @@ else {
|
||||
}
|
||||
|
||||
foreach (dbFetchRows('SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id ORDER BY hostname') as $device) {
|
||||
$servicesform .= "<option value='".$device['service_id']."'>".$device['service_id'].'.'.$device['hostname'].' - '.$device['service_type'].'</option>';
|
||||
$service_description = '';
|
||||
|
||||
if (!empty($device['service_desc'])) {
|
||||
$service_description = ' - ' . substr($device['service_desc'], 0, 30);
|
||||
}
|
||||
|
||||
$servicesform .= "<option value='".$device['service_id']."'>".$device['hostname'].' - '.$device['service_type'].$service_description.'</option>';
|
||||
|
||||
}
|
||||
|
||||
if ($updated) {
|
||||
@@ -26,7 +33,7 @@ else {
|
||||
<input type=hidden name='delsrv' value='yes'>
|
||||
<div class='well well-lg'>
|
||||
<div class='form-group'>
|
||||
<label for='service' class='col-sm-2 control-label'>Device - Service</label>
|
||||
<label for='service' class='col-sm-2 control-label'>Device - Service - Description</label>
|
||||
<div class='col-sm-5'>
|
||||
<select name='service' id='service' class='form-control input-sm'>
|
||||
$servicesform
|
||||
|
||||
@@ -13,7 +13,13 @@ else {
|
||||
}
|
||||
|
||||
foreach (dbFetchRows('SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id ORDER BY hostname') as $device) {
|
||||
$servicesform .= "<option value='".$device['service_id']."'>".$device['hostname'].' - '.$device['service_type'].'</option>';
|
||||
$service_description = '';
|
||||
|
||||
if (!empty($device['service_desc'])) {
|
||||
$service_description = ' - ' . substr($device['service_desc'], 0, 30);
|
||||
}
|
||||
|
||||
$servicesform .= "<option value='".$device['service_id']."'>".$device['hostname'].' - '.$device['service_type'].$service_description.'</option>';
|
||||
}
|
||||
|
||||
if ($updated) {
|
||||
@@ -30,7 +36,7 @@ else {
|
||||
<input type=hidden name='delsrv' value='yes'>
|
||||
<div class='well well-lg'>
|
||||
<div class='form-group'>
|
||||
<label for='service' class='col-sm-2 control-label'>Device - Service</label>
|
||||
<label for='service' class='col-sm-2 control-label'>Device - Service - Description</label>
|
||||
<div class='col-sm-5'>
|
||||
<select name='service' id='service' class='form-control input-sm'>
|
||||
$servicesform
|
||||
|
||||
@@ -225,19 +225,27 @@ function poll_device($device, $options) {
|
||||
else {
|
||||
foreach ($config['poller_modules'] as $module => $module_status) {
|
||||
if ($attribs['poll_'.$module] || ( $module_status && !isset($attribs['poll_'.$module]))) {
|
||||
// TODO per-module polling stats
|
||||
$module_start = microtime(true);
|
||||
include 'includes/polling/'.$module.'.inc.php';
|
||||
$module_time = microtime(true) - $module_start;
|
||||
echo "Runtime for polling module '$module': $module_time\n";
|
||||
|
||||
// save per-module poller stats
|
||||
$tags = array(
|
||||
'rrd_def' => 'DS:'.$module.':GAUGE:600:0:U',
|
||||
'module' => $module,
|
||||
'rrd_def' => 'DS:poller:GAUGE:600:0:U',
|
||||
'rrd_name' => array('poller-perf', $module),
|
||||
);
|
||||
$fields = array(
|
||||
$module => $module_time,
|
||||
'poller' => $module_time,
|
||||
);
|
||||
data_update($device, 'poller-'.$module.'-perf', $tags, $fields);
|
||||
data_update($device, 'poller-perf', $tags, $fields);
|
||||
|
||||
// remove old rrd
|
||||
$oldrrd = rrd_name($device['hostname'], array('poller', $module, 'perf'));
|
||||
if (is_file($oldrrd)) {
|
||||
unlink($oldrrd);
|
||||
}
|
||||
}
|
||||
else if (isset($attribs['poll_'.$module]) && $attribs['poll_'.$module] == '0') {
|
||||
echo "Module [ $module ] disabled on host.\n";
|
||||
@@ -280,6 +288,7 @@ function poll_device($device, $options) {
|
||||
if (!empty($device_time)) {
|
||||
$tags = array(
|
||||
'rrd_def' => 'DS:poller:GAUGE:600:0:U',
|
||||
'module' => 'ALL',
|
||||
);
|
||||
$fields = array(
|
||||
'poller' => $device_time,
|
||||
|
||||
Reference in New Issue
Block a user