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:
Zane C. Bowers-Hadley
2023-06-15 09:06:28 -05:00
committed by GitHub
parent b0ddd4ef15
commit 5da8e70bf4
10 changed files with 640 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
<?php
$name = 'sneck';
$unit_text = 'Results';
$colours = 'psychedelic';
$dostack = 0;
$descr_len = 10;
$addarea = 0;
$transparency = 15;
$float_precision = 0;
$rrd_filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id]);
$rrd_list = [];
if (Rrd::checkRrdExists($rrd_filename)) {
$rrd_list[] = [
'filename' => $rrd_filename,
'descr' => 'OK',
'ds' => 'ok',
];
$rrd_list[] = [
'filename' => $rrd_filename,
'descr' => 'Warning',
'ds' => 'warning',
];
$rrd_list[] = [
'filename' => $rrd_filename,
'descr' => 'Critical',
'ds' => 'critical',
];
$rrd_list[] = [
'filename' => $rrd_filename,
'descr' => 'Unknown',
'ds' => 'unknown',
];
$rrd_list[] = [
'filename' => $rrd_filename,
'descr' => 'Errored',
'ds' => 'errored',
];
} else {
d_echo('RRD "' . $rrd_filename . '" not found');
}
require 'includes/html/graphs/generic_multi_line.inc.php';

View File

@@ -0,0 +1,29 @@
<?php
$name = 'sneck';
$unit_text = 'Diff In Secs';
$colours = 'psychedelic';
$dostack = 0;
$printtotal = 0;
$addarea = 0;
$transparency = 15;
$rrd_filename = Rrd::name($device['hostname'], ['app', $name, $app->app_id]);
$rrd_list = [];
if (Rrd::checkRrdExists($rrd_filename)) {
$rrd_list[] = [
'filename' => $rrd_filename,
'descr' => 'On Dev',
'ds' => 'time',
];
$rrd_list[] = [
'filename' => $rrd_filename,
'descr' => 'To Polling',
'ds' => 'time_to_polling',
];
} else {
d_echo('RRD "' . $rrd_filename . '" not found');
}
require 'includes/html/graphs/generic_multi_line.inc.php';