mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
add Sneck support, making it very trivial to use Nagios style checks in a NRPE like manner (#13954)
* code stuff done for Sneck * whoops, correct the abs value post adding it post rrd update * return a array for getting the sneck data and nicely print the raw return value * add test stuff and freeze time at 1650911765 for tests * move the freezeTime * add use Illuminate\Support\Carbon; * more test changes * rework freezeTime a bit more * more test stuff * another test * rework it a bit again * correct variable spelling for $time_diff * remove freezeTime as we are using a old version of Laravel * finalize graphs * misc * finalize sneck page * mve the sneck tests as it needs a newer version of laravel than we are using * add documents for sneck * finalize the poller * formatting cleanup * correct comment type * correct the spelling of description * more documentation * save the check returns as metrics * add some more examples * fix some of the sneck alerts and add a few more examples * turn off time to polling by default * suggest using ntp if enabled * since we are zeroing time_to_polling by default, this now works * backout some suggested changes for once we change to larval 9 * remove del_sneck_data as it is no longer used * add more docs on the metrics * php-cs-fixer to fix a few things * update and fix sneck tests * remote a metric from the test * another minor tweak to the test * one more minor change * ahh! derp! think I found it finally... hopefully hanging this for the last time... * now use app data * now logs check changes * add a missing ) * add a missing ) * some style fixes * update the sneck page use to the app data stuff * update the poller to use the new app data * misc * update sneck to log check status changes * correct alert log messages * correct a comment * fix metrics * derp, another fix * test fix * re-order to avoid warning * poller update * update sneck graphs * update sneck graphs * remove a unneeded line * test update for discovery * minor tweaks to the test and fix update the polling a bit * style fix * fix return data printing * fix the test data to include app data * attempted test fix * add config def to apps.sneck.polling_time_diff * cleanup docs a bit * minor config tweaks * minor doc cleanup
This commit is contained in:
committed by
GitHub
parent
b0ddd4ef15
commit
5da8e70bf4
52
includes/html/pages/device/apps/sneck.inc.php
Normal file
52
includes/html/pages/device/apps/sneck.inc.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
$link_array = [
|
||||
'page' => 'device',
|
||||
'device' => $device['device_id'],
|
||||
'tab' => 'apps',
|
||||
'app' => 'sneck',
|
||||
];
|
||||
|
||||
$link_array = [
|
||||
'page' => 'device',
|
||||
'device' => $device['device_id'],
|
||||
'tab' => 'apps',
|
||||
'app' => 'sneck',
|
||||
];
|
||||
|
||||
$graphs = [
|
||||
'sneck_results'=>'Results',
|
||||
'sneck_time'=>'Time Difference',
|
||||
];
|
||||
|
||||
foreach ($graphs as $key => $text) {
|
||||
$graph_type = $key;
|
||||
$graph_array['height'] = '100';
|
||||
$graph_array['width'] = '215';
|
||||
$graph_array['to'] = \LibreNMS\Config::get('time.now');
|
||||
$graph_array['id'] = $app->app_id;
|
||||
$graph_array['type'] = 'application_' . $key;
|
||||
|
||||
echo '<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">' . $text . '</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="row">';
|
||||
include 'includes/html/print-graphrow.inc.php';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
// print any alerts if found
|
||||
$sneck_data = $app->app_id;
|
||||
if (isset($sneck_data)) {
|
||||
print_optionbar_start();
|
||||
echo 'Last Return...<br>';
|
||||
echo "<b>Alert(s):</b><br>\n";
|
||||
echo str_replace("\n", "<br>\n", $app->data['data']['alertString']) . "<br><br>\n";
|
||||
echo "<b>Raw JSON:</b><br>\n";
|
||||
echo "<pre>\n" . json_encode($app->data, JSON_PRETTY_PRINT) . "</pre>\n";
|
||||
print_optionbar_end();
|
||||
}
|
Reference in New Issue
Block a user