Prettify the poller + disco output #3694

Merged
merged 5 commits into from Jun 23, 2016

Projects

None yet

5 participants

@laf
Member
laf commented Jun 21, 2016

Output now looks like:

#### Load poller module storage ####
Storage /: 3% [RRD Disabled]
Storage /sys/fs/cgroup: 0% [RRD Disabled]
Storage /sys/fs/cgroup/cgmanager: 0% [RRD Disabled]
Storage /dev/shm: 0% [RRD Disabled]
Storage /run: 9% [RRD Disabled]
Storage /run/user/0: 0% [RRD Disabled]
Storage /run/user/997: 0% [RRD Disabled]

>> Runtime for poller module 'storage': 0.450 seconds
#### Unload poller module storage ####

Tidies things up a little.

Also fixed a bug where the device group include was setting debug.

laf added some commits Jun 20, 2016
@laf laf Pretty up the discovery process output 558dfb2
@laf laf Pretty up the polling process output a194009
@laf laf Updated module run time to be limited to 5 decimal places
246664d
@paulgear
Member

+1000 - why didn't we do this months/years ago? :-)

@murrant
Contributor
murrant commented Jun 21, 2016

Nice!

I have a feeling I left the debug in there :-/

@murrant murrant commented on an outdated diff Jun 21, 2016
includes/device-groups.inc.php
@@ -237,7 +237,6 @@ function RunGroupMacros($rule,$x=1) {
function UpdateGroupsForDevice($device_id)
{
global $debug;
@murrant
murrant Jun 21, 2016 Contributor

Remove the global too as it isn't used.

@laf laf Removed global $debug line
a05cfbe
@laf
Member
laf commented Jun 21, 2016

Done

@murrant murrant commented on an outdated diff Jun 22, 2016
includes/discovery/functions.inc.php
@@ -851,3 +848,13 @@ function avtech_add_sensor($device, $sensor) {
return true;
}
+function load_discovery_module($module, $device, $attribs) {
+ global $config, $valid;
+ $module_start = microtime(true);
+ echo "#### Load disco module $module ####\n";
+ include "includes/discovery/$module.inc.php";
+ $module_time = microtime(true) - $module_start;
+ $module_time = substr($module_time, 0, 5)
@murrant
murrant Jun 22, 2016 Contributor

Missing semi-colin

@murrant murrant commented on the diff Jun 22, 2016
includes/polling/functions.inc.php
@@ -237,17 +237,14 @@ function poll_device($device, $options) {
if ($options['m']) {
foreach (explode(',', $options['m']) as $module) {
if (is_file('includes/polling/'.$module.'.inc.php')) {
- include 'includes/polling/'.$module.'.inc.php';
+ load_poller_module($module, $device, $attribs);
@murrant
murrant Jun 22, 2016 Contributor

The call to load_poller_module() has too many arguments starting with $attribs.

@murrant murrant and 1 other commented on an outdated diff Jun 22, 2016
includes/polling/functions.inc.php
}
}
}
else {
foreach ($config['poller_modules'] as $module => $module_status) {
if ($attribs['poll_'.$module] || ( $module_status && !isset($attribs['poll_'.$module]))) {
- $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";
+ load_poller_module($module, $device, $attribs);
@murrant
murrant Jun 22, 2016 Contributor

The call to load_poller_module() has too many arguments starting with $attribs.

@f0o
f0o Jun 22, 2016 Member

how do you mean?

@murrant
murrant Jun 22, 2016 Contributor

This is an error from scrutinizer-ci. The load_poller_module() only has two arguments, but three are given in these two calls.

@laf laf Fixed errors from scrut/murrant
5d16cdb
@laf
Member
laf commented Jun 22, 2016

Should be sorted now. Thanks.

@murrant murrant merged commit 9c5017f into librenms:master Jun 23, 2016

2 checks passed

Auto-Deploy Build finished.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@laf laf deleted the laf:pretty-disco-poller branch Jun 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment