mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
add the Mojo CAPE Submit app (#15140)
* add poller for mojo cape submit * mojo_cape_submit poller now works * add app page for mojo_cape_submit * add basic generic stat graphs for mojo cape submit * general size stats graph for mojo_cape_submit * make sure we update slugs that did not see anything submitted for them * sort the slugs by sub count * add app protos graph and sub top 12 graphs * add mojo cape submit docs * add tests for mojo_cape_submit * add mojo_cape_submit to the apps page * add string helper for mojo_cape_submit * poke lots of stuff with php-cs-fixer * remove a unneeded line * add a missing metric and app data to test
This commit is contained in:
committed by
GitHub
parent
510d5dc94b
commit
54a38dd4cd
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
$name = 'mojo_cape_submit';
|
||||
$unit_text = 'App Protos';
|
||||
$colours = 'psychedelic';
|
||||
$descr = 'App Protos';
|
||||
$ds = 'app_protos';
|
||||
|
||||
if (isset($vars['slug'])) {
|
||||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id, 'slugs___-___' . $vars['slug']]);
|
||||
} else {
|
||||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id]);
|
||||
}
|
||||
|
||||
if (! Rrd::checkRrdExists($filename)) {
|
||||
d_echo('RRD "' . $filename . '" not found');
|
||||
}
|
||||
|
||||
require 'includes/html/graphs/generic_stats.inc.php';
|
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
$name = 'mojo_cape_submit';
|
||||
$unit_text = 'Changed Hashes';
|
||||
$colours = 'psychedelic';
|
||||
$descr = 'Change Count';
|
||||
$ds = 'hash_changed';
|
||||
|
||||
if (isset($vars['slug'])) {
|
||||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id, 'slugs___-___' . $vars['slug']]);
|
||||
} else {
|
||||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id]);
|
||||
}
|
||||
|
||||
if (! Rrd::checkRrdExists($filename)) {
|
||||
d_echo('RRD "' . $filename . '" not found');
|
||||
}
|
||||
|
||||
require 'includes/html/graphs/generic_stats.inc.php';
|
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
$name = 'mojo_cape_submit';
|
||||
$unit_text = 'Bytes';
|
||||
$colours = 'psychedelic';
|
||||
$descr = 'Size Sum';
|
||||
$ds = 'Size Sum';
|
||||
|
||||
if (isset($vars['slug'])) {
|
||||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id, 'slugs___-___' . $vars['slug']]);
|
||||
} else {
|
||||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id]);
|
||||
}
|
||||
|
||||
if (! Rrd::checkRrdExists($filename)) {
|
||||
d_echo('RRD "' . $filename . '" not found');
|
||||
}
|
||||
|
||||
require 'includes/html/graphs/generic_stats.inc.php';
|
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
$name = 'mojo_cape_submit';
|
||||
$unit_text = 'Bytes';
|
||||
$colours = 'psychedelic';
|
||||
$descr = 'Size max';
|
||||
$ds = 'size_max';
|
||||
|
||||
if (isset($vars['slug'])) {
|
||||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id, 'slugs___-___' . $vars['slug']]);
|
||||
} else {
|
||||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id]);
|
||||
}
|
||||
|
||||
if (! Rrd::checkRrdExists($filename)) {
|
||||
d_echo('RRD "' . $filename . '" not found');
|
||||
}
|
||||
|
||||
require 'includes/html/graphs/generic_stats.inc.php';
|
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
$name = 'mojo_cape_submit';
|
||||
$unit_text = 'Bytes';
|
||||
$colours = 'psychedelic';
|
||||
$descr = 'Size Mean';
|
||||
$ds = 'size_mean';
|
||||
|
||||
if (isset($vars['slug'])) {
|
||||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id, 'slugs___-___' . $vars['slug']]);
|
||||
} else {
|
||||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id]);
|
||||
}
|
||||
|
||||
if (! Rrd::checkRrdExists($filename)) {
|
||||
d_echo('RRD "' . $filename . '" not found');
|
||||
}
|
||||
|
||||
require 'includes/html/graphs/generic_stats.inc.php';
|
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
$name = 'mojo_cape_submit';
|
||||
$unit_text = 'Bytes';
|
||||
$colours = 'psychedelic';
|
||||
$descr = 'Size Median';
|
||||
$ds = 'size_median';
|
||||
|
||||
if (isset($vars['slug'])) {
|
||||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id, 'slugs___-___' . $vars['slug']]);
|
||||
} else {
|
||||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id]);
|
||||
}
|
||||
|
||||
if (! Rrd::checkRrdExists($filename)) {
|
||||
d_echo('RRD "' . $filename . '" not found');
|
||||
}
|
||||
|
||||
require 'includes/html/graphs/generic_stats.inc.php';
|
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
$name = 'mojo_cape_submit';
|
||||
$unit_text = 'Bytes';
|
||||
$colours = 'psychedelic';
|
||||
$descr = 'Size Min';
|
||||
$ds = 'size_min';
|
||||
|
||||
if (isset($vars['slug'])) {
|
||||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id, 'slugs___-___' . $vars['slug']]);
|
||||
} else {
|
||||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id]);
|
||||
}
|
||||
|
||||
if (! Rrd::checkRrdExists($filename)) {
|
||||
d_echo('RRD "' . $filename . '" not found');
|
||||
}
|
||||
|
||||
require 'includes/html/graphs/generic_stats.inc.php';
|
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
$name = 'mojo_cape_submit';
|
||||
$unit_text = 'Bytes';
|
||||
$colours = 'psychedelic';
|
||||
$descr = 'Size Mode';
|
||||
$ds = 'size_mode';
|
||||
|
||||
if (isset($vars['slug'])) {
|
||||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id, 'slugs___-___' . $vars['slug']]);
|
||||
} else {
|
||||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id]);
|
||||
}
|
||||
|
||||
if (! Rrd::checkRrdExists($filename)) {
|
||||
d_echo('RRD "' . $filename . '" not found');
|
||||
}
|
||||
|
||||
require 'includes/html/graphs/generic_stats.inc.php';
|
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
$name = 'mojo_cape_submit';
|
||||
$unit_text = 'Bytes';
|
||||
$colours = 'psychedelic';
|
||||
$dostack = 0;
|
||||
$printtotal = 0;
|
||||
$addarea = 1;
|
||||
$transparency = 15;
|
||||
|
||||
if (isset($vars['slug'])) {
|
||||
$rrd_filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id, 'slugs___-___' . $vars['slug']]);
|
||||
} else {
|
||||
$rrd_filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id]);
|
||||
}
|
||||
|
||||
$rrd_list = [];
|
||||
if (Rrd::checkRrdExists($rrd_filename)) {
|
||||
$rrd_list[] = [
|
||||
'filename' => $rrd_filename,
|
||||
'descr' => 'Max',
|
||||
'ds' => 'size_max',
|
||||
];
|
||||
$rrd_list[] = [
|
||||
'filename' => $rrd_filename,
|
||||
'descr' => 'Mean',
|
||||
'ds' => 'size_mean',
|
||||
];
|
||||
$rrd_list[] = [
|
||||
'filename' => $rrd_filename,
|
||||
'descr' => 'Median',
|
||||
'ds' => 'size_median',
|
||||
];
|
||||
$rrd_list[] = [
|
||||
'filename' => $rrd_filename,
|
||||
'descr' => 'Mode',
|
||||
'ds' => 'size_mode',
|
||||
];
|
||||
$rrd_list[] = [
|
||||
'filename' => $rrd_filename,
|
||||
'descr' => 'Min',
|
||||
'ds' => 'size_min',
|
||||
];
|
||||
} else {
|
||||
d_echo('RRD "' . $rrd_filename . '" not found');
|
||||
}
|
||||
|
||||
require 'includes/html/graphs/generic_multi_line.inc.php';
|
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
$name = 'mojo_cape_submit';
|
||||
$unit_text = 'Bytes';
|
||||
$colours = 'psychedelic';
|
||||
$descr = 'Size StdDev';
|
||||
$ds = 'size_stddev';
|
||||
|
||||
if (isset($vars['slug'])) {
|
||||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id, 'slugs___-___' . $vars['slug']]);
|
||||
} else {
|
||||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id]);
|
||||
}
|
||||
|
||||
if (! Rrd::checkRrdExists($filename)) {
|
||||
d_echo('RRD "' . $filename . '" not found');
|
||||
}
|
||||
|
||||
require 'includes/html/graphs/generic_stats.inc.php';
|
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
$name = 'mojo_cape_submit';
|
||||
$unit_text = 'Bytes';
|
||||
$colours = 'psychedelic';
|
||||
$descr = 'Size Sum';
|
||||
$ds = 'size_sum';
|
||||
|
||||
if (isset($vars['slug'])) {
|
||||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id, 'slugs___-___' . $vars['slug']]);
|
||||
} else {
|
||||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id]);
|
||||
}
|
||||
|
||||
if (! Rrd::checkRrdExists($filename)) {
|
||||
d_echo('RRD "' . $filename . '" not found');
|
||||
}
|
||||
|
||||
require 'includes/html/graphs/generic_stats.inc.php';
|
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
$name = 'mojo_cape_submit';
|
||||
$unit_text = 'Submissions';
|
||||
$colours = 'psychedelic';
|
||||
$descr = 'Sub Count';
|
||||
$ds = 'sub_count';
|
||||
|
||||
if (isset($vars['slug'])) {
|
||||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id, 'slugs___-___' . $vars['slug']]);
|
||||
} else {
|
||||
$filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id]);
|
||||
}
|
||||
|
||||
if (! Rrd::checkRrdExists($filename)) {
|
||||
d_echo('RRD "' . $filename . '" not found');
|
||||
}
|
||||
|
||||
require 'includes/html/graphs/generic_stats.inc.php';
|
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
$name = 'mojo_cape_submit';
|
||||
$app_id = $app['app_id'];
|
||||
$unit_text = 'Bytes';
|
||||
$colours = 'rainbow';
|
||||
$dostack = 0;
|
||||
$printtotal = 1;
|
||||
$addarea = 0;
|
||||
$transparency = 0;
|
||||
$float_precision = 3;
|
||||
|
||||
$slugs_all = $app->data['slugs'] ?? [];
|
||||
|
||||
$slugs = array_slice(array_keys($slugs_all), 0, 12);
|
||||
|
||||
$rrd_list = [];
|
||||
foreach ($slugs as $index => $slug) {
|
||||
$rrd_filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id, 'slugs___-___' . $slug]);
|
||||
$rrd_list[] = [
|
||||
'filename' => $rrd_filename,
|
||||
'descr' => $slug,
|
||||
'ds' => 'sub_count',
|
||||
];
|
||||
}
|
||||
|
||||
if (count($rrd_list)) {
|
||||
d_echo('No relevant log file RRDs found');
|
||||
}
|
||||
|
||||
require 'includes/html/graphs/generic_multi_line.inc.php';
|
Reference in New Issue
Block a user