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
@@ -2508,6 +2508,101 @@ Also if the system you are using uses non-static device naming based
|
||||
on bus information, it may be worthwhile just using the SN as the
|
||||
device ID is going to be irrelevant in that case.
|
||||
|
||||
## Sneck
|
||||
|
||||
This is for replacing Nagios/Icinga or the LibreNMS service
|
||||
integration in regards to NRPE. This allows LibreNMS to query what
|
||||
checks were ran on the server and keep track of totals of OK, WARNING,
|
||||
CRITICAL, and UNKNOWN statuses.
|
||||
|
||||
The big advantage over this compared to a NRPE are as below.
|
||||
|
||||
- It does not need to know what checks are configured on it.
|
||||
- Also does not need to wait for the tests to run as sneck is meant to
|
||||
be ran via cron and the then return the cache when queried via SNMP,
|
||||
meaning a lot faster response time, especially if slow checks are
|
||||
being performed.
|
||||
- Works over proxied SNMP connections.
|
||||
|
||||
Included are alert examples. Although for setting up custom ones, the
|
||||
metrics below are provided.
|
||||
|
||||
| Metric | Description |
|
||||
|---------------------|-----------------------------------------------------------------------------------------------------------------------|
|
||||
| ok | Total OK checks |
|
||||
| warning | Total WARNING checks |
|
||||
| critical | Total CRITICAL checks |
|
||||
| unknown | Total UNKNOWN checks |
|
||||
| errored | Total checks that errored |
|
||||
| time_to_polling | Differnce in seconds between when polling data was generated and when polled |
|
||||
| time_to_polling_abs | The aboslute value of time_to_polling. |
|
||||
| check_$CHECK | Exit status of a specific check `$CHECK` is equal to the name of the check in question. So `foo` would be `check_foo` |
|
||||
|
||||
The standard Nagios/Icinga style exit codes are used and those are as
|
||||
below.
|
||||
|
||||
| Exit | Meaning |
|
||||
|------|----------|
|
||||
| 0 | okay |
|
||||
| 1 | warning |
|
||||
| 2 | critical |
|
||||
| 3+ | unknown |
|
||||
|
||||
To use `time_to_polling`, it will need to enabled via setting the
|
||||
config item below. The default is false. Unless set to true, this
|
||||
value will default to 0. If enabling this, one will want to make sure
|
||||
that NTP is in use every were or it will alert if it goes over a
|
||||
difference of 540s.
|
||||
|
||||
```
|
||||
lnms config:set app.sneck.polling_time_diff true
|
||||
```
|
||||
|
||||
For more information on Sneck, check it out at
|
||||
[MetaCPAN](https://metacpan.org/dist/Monitoring-Sneck) or
|
||||
[Github](https://github.com/VVelox/Monitoring-Sneck).
|
||||
|
||||
For poking systems using Sneck, also check out boop_snoot
|
||||
if one wants to query those systems via the CLI. Docs on it
|
||||
at [MetaCPAN](https://metacpan.org/dist/Monitoring-Sneck-Boop_Snoot) and
|
||||
[Github](https://github.com/VVelox/Monitoring-Sneck-Boop_Snoot).
|
||||
|
||||
### SNMP Extend
|
||||
|
||||
1. Install the extend.
|
||||
|
||||
```
|
||||
# FreeBSD
|
||||
pkg install p5-JSON p5-File-Slurp p5-MIME-Base64 p5-Gzip-Faster p5-App-cpanminus
|
||||
cpanm Monitoring::Sneck
|
||||
# Debian based systems
|
||||
apt-get install zlib1g-dev cpanminus
|
||||
cpanm Monitoring::Sneck
|
||||
```
|
||||
|
||||
2. Configure any of the checks you want to run in
|
||||
`/usr/local/etc/sneck.conf`. You con find it documented
|
||||
[here](https://metacpan.org/pod/Monitoring::Sneck#CONFIG-FORMAT).
|
||||
|
||||
3. Set it up in cron. This will mean you don't need to wait for all
|
||||
the checks to complete when polled via SNMP, which for like SMART
|
||||
or other long running checks will mean it timing out. Also means it
|
||||
does not need called via sudo as well.
|
||||
|
||||
```
|
||||
*/5 * * * * /usr/bin/env PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin /usr/local/bin/sneck -u 2> /dev/null > /dev/null
|
||||
```
|
||||
|
||||
4. Set it up in the snmpd config and restart snmpd. The `-c` flag will
|
||||
tell read it to read from cache instead of rerunning the checks.
|
||||
|
||||
```
|
||||
extend sneck /usr/bin/env PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin /usr/local/bin/sneck -c
|
||||
```
|
||||
|
||||
5. In LibreNMS, enable the application for the server in question or wait for auto
|
||||
discovery to find it.
|
||||
|
||||
## Squid
|
||||
|
||||
### SNMP Proxy
|
||||
|
45
includes/html/graphs/application/sneck_results.inc.php
Normal file
45
includes/html/graphs/application/sneck_results.inc.php
Normal 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';
|
29
includes/html/graphs/application/sneck_time.inc.php
Normal file
29
includes/html/graphs/application/sneck_time.inc.php
Normal 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';
|
@@ -96,6 +96,10 @@ $graphs['powerdns'] = [
|
||||
'queries',
|
||||
'queries_udp',
|
||||
];
|
||||
$graphs['sneck'] = [
|
||||
'results',
|
||||
'time',
|
||||
];
|
||||
$graphs['ntp-client'] = [
|
||||
'stats',
|
||||
'freq',
|
||||
|
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();
|
||||
}
|
159
includes/polling/applications/sneck.inc.php
Normal file
159
includes/polling/applications/sneck.inc.php
Normal file
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
|
||||
use Carbon\Carbon;
|
||||
use LibreNMS\Config;
|
||||
use LibreNMS\Exceptions\JsonAppException;
|
||||
use LibreNMS\RRD\RrdDefinition;
|
||||
|
||||
$name = 'sneck';
|
||||
|
||||
$old_checks = [];
|
||||
$old_checks_data = [];
|
||||
if (isset($app->data['data']) && isset($app->data['data']['checks'])) {
|
||||
$old_checks = array_keys($app->data['data']['checks']);
|
||||
$old_checks_data = $app->data['data']['checks'];
|
||||
}
|
||||
|
||||
if (Config::has('apps.sneck.polling_time_diff')) {
|
||||
$compute_time_diff = Config::get('apps.sneck.polling_time_diff');
|
||||
} else {
|
||||
$compute_time_diff = false;
|
||||
}
|
||||
|
||||
try {
|
||||
$json_return = json_app_get($device, $name, 1);
|
||||
} catch (JsonAppException $e) {
|
||||
echo PHP_EOL . $name . ':' . $e->getCode() . ':' . $e->getMessage() . PHP_EOL;
|
||||
// Set empty metrics and error message
|
||||
update_application($app, $e->getCode() . ':' . $e->getMessage(), []);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$app->data = $json_return;
|
||||
|
||||
$new_checks = [];
|
||||
if (isset($json_return['data']) and isset($json_return['data']['checks'])) {
|
||||
$new_checks = array_keys($json_return['data']['checks']);
|
||||
}
|
||||
|
||||
$rrd_name = ['app', $name, $app->app_id];
|
||||
$rrd_def = RrdDefinition::make()
|
||||
->addDataset('time', 'DERIVE', 0)
|
||||
->addDataset('time_to_polling', 'GAUGE', 0)
|
||||
->addDataset('ok', 'GAUGE', 0)
|
||||
->addDataset('warning', 'GAUGE', 0)
|
||||
->addDataset('critical', 'GAUGE', 0)
|
||||
->addDataset('unknown', 'GAUGE', 0)
|
||||
->addDataset('errored', 'GAUGE', 0);
|
||||
|
||||
// epoch off set between poller and when the when the JSON was generated
|
||||
// only compueted if
|
||||
if ($compute_time_diff) {
|
||||
$time_to_polling = Carbon::now()->timestamp - $json_return['data']['time'];
|
||||
} else {
|
||||
$time_to_polling = 0;
|
||||
}
|
||||
|
||||
$fields = [
|
||||
'time' => $json_return['data']['time'],
|
||||
'time_to_polling' => $time_to_polling,
|
||||
'ok' => $json_return['data']['ok'],
|
||||
'warning' => $json_return['data']['warning'],
|
||||
'critical' => $json_return['data']['critical'],
|
||||
'unknown' => $json_return['data']['unknown'],
|
||||
'errored' => $json_return['data']['errored'],
|
||||
];
|
||||
|
||||
$tags = ['name' => $name, 'app_id' => $app->app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name];
|
||||
data_update($device, 'app', $tags, $fields);
|
||||
|
||||
// save the return status for each alerting possibilities
|
||||
foreach ($json_return['data']['checks'] as $key => $value) {
|
||||
$fields['check_' . $key] = $value['exit'];
|
||||
}
|
||||
|
||||
$fields['time_to_polling_abs'] = abs($time_to_polling);
|
||||
|
||||
if (abs($time_to_polling) > 540) {
|
||||
$json_return['data']['alertString'] = $json_return['data']['alertString'] . "\nGreater than 540 seconds since the polled data was generated";
|
||||
$json_return['data']['alert'] = 1;
|
||||
}
|
||||
|
||||
//check for added checks
|
||||
$added_checks = array_values(array_diff($new_checks, $old_checks));
|
||||
|
||||
//check for removed checks
|
||||
$removed_checks = array_values(array_diff($old_checks, $new_checks));
|
||||
|
||||
// if we have any check changes, log it
|
||||
if (sizeof($added_checks) > 0 || sizeof($removed_checks) > 0) {
|
||||
$log_message = 'Sneck Check Change:';
|
||||
$log_message .= count($added_checks) > 0 ? ' Added ' . json_encode($added_checks) : '';
|
||||
$log_message .= count($removed_checks) > 0 ? ' Removed ' . json_encode($added_checks) : '';
|
||||
log_event($log_message, $device, 'application');
|
||||
}
|
||||
|
||||
// go through and looking for status changes
|
||||
$cleared = [];
|
||||
$warned = [];
|
||||
$alerted = [];
|
||||
$unknowned = [];
|
||||
foreach ($new_checks as $check) {
|
||||
if (isset($old_checks_data[$check]) && isset($old_checks_data[$check]['exit']) && isset($old_checks_data[$check]['output'])) {
|
||||
if ($json_return['data']['checks'][$check]['exit'] != $app->data['data']['checks'][$check]['exit']) {
|
||||
$check_output = $json_return['data']['checks'][$check]['output'];
|
||||
$exit_code = $json_return['data']['checks'][$check]['exit'];
|
||||
|
||||
if ($exit_code == 1) {
|
||||
$warned[$check] = $check_output;
|
||||
} elseif ($exit_code == 2) {
|
||||
$alerted[$check] = $check_output;
|
||||
} elseif ($exit_code >= 3) {
|
||||
$unknowned[$check] = $check_output;
|
||||
} elseif ($exit_code == 0) {
|
||||
$cleared[$check] = $check_output;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (isset($json_return['data']['checks'][$check]['exit']) && isset($json_return['data']['checks'][$check]['output'])) {
|
||||
$check_output = $json_return['data']['checks'][$check]['output'];
|
||||
$exit_code = $json_return['data']['checks'][$check]['exit'];
|
||||
|
||||
if ($exit_code == 1) {
|
||||
$warned[$check] = $check_output;
|
||||
} elseif ($exit_code == 2) {
|
||||
$alerted[$check] = $check_output;
|
||||
} elseif ($exit_code >= 3) {
|
||||
$unknowned[$check] = $check_output;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// log any clears
|
||||
if (sizeof($cleared) > 0) {
|
||||
$log_message = 'Sneck Check Clears: ' . json_encode($cleared);
|
||||
log_event($log_message, $device, 'application', 1);
|
||||
}
|
||||
|
||||
// log any warnings
|
||||
if (sizeof($warned) > 0) {
|
||||
$log_message = 'Sneck Check Warns: ' . json_encode($warned);
|
||||
log_event($log_message, $device, 'application', 4);
|
||||
}
|
||||
|
||||
// log any alerts
|
||||
if (sizeof($alerted) > 0) {
|
||||
$log_message = 'Sneck Check Alerts: ' . json_encode($alerted);
|
||||
log_event($log_message, $device, 'application', 5);
|
||||
}
|
||||
|
||||
// log any unknowns
|
||||
if (sizeof($unknowned) > 0) {
|
||||
$log_message = 'Sneck Check Unknowns: ' . json_encode($unknownwed);
|
||||
log_event($log_message, $device, 'application', 6);
|
||||
}
|
||||
|
||||
// update it here as we are done with this mostly
|
||||
update_application($app, 'OK', $fields);
|
@@ -483,6 +483,126 @@
|
||||
"builder": {"condition":"AND","rules":[{"id":"ports.ifSpeed","field":"ports.ifSpeed","type":"string","input":"text","operator":"greater","value":"0"},{"id":"ports.ifSpeed","field":"ports.ifSpeed","type":"string","input":"text","operator":"less","value":"`ports.ifSpeed_prev`"},{"id":"eventlog.message","field":"eventlog.message","type":"string","input":"text","operator":"begins_with","value":"ifSpeed:"},{"id":"eventlog.datetime","field":"eventlog.datetime","type":"datetime","input":"text","operator":"greater_or_equal","value":"`macros.past_10m`"},{"id":"ports.port_id","field":"ports.port_id","type":"string","input":"text","operator":"equal","value":"`eventlog.reference`"},{"id":"ports.ifOperStatus","field":"ports.ifOperStatus","type":"string","input":"text","operator":"equal","value":"up"},{"id":"ports.disabled","field":"ports.disabled","type":"string","input":"text","operator":"equal","value":"0"}],"valid":true},
|
||||
"name": "Port Speed Degraded"
|
||||
},
|
||||
{
|
||||
"rule": "applications.app_type = \"sneck\" && application_metrics.metric = \"warning\" && application_metrics.value >= \"1\"",
|
||||
"name": "Sneck Warnings >= 1",
|
||||
"severity": "warning"
|
||||
},
|
||||
{
|
||||
"rule": "applications.app_type = \"sneck\" && application_metrics.metric = \"critical\" && application_metrics.value >= \"1\"",
|
||||
"name": "Sneck Critical >= 1",
|
||||
"severity": "critical"
|
||||
},
|
||||
{
|
||||
"rule": "applications.app_type = \"sneck\" && application_metrics.metric = \"unknown\" && application_metrics.value >= \"1\"",
|
||||
"name": "Sneck Unknown >= 1",
|
||||
"severity": "critical"
|
||||
},
|
||||
{
|
||||
"rule": "applications.app_type = \"sneck\" && application_metrics.metric = \"errored\" && application_metrics.value >= \"1\"",
|
||||
"name": "Sneck Errored >= 1",
|
||||
"severity": "critical"
|
||||
},
|
||||
{
|
||||
"rule": "applications.app_type = \"sneck\" && application_metrics.metric = \"check_ipmi_psu\" && application_metrics.value = \"1\"",
|
||||
"name": "Sneck - IPMI PSU Warning",
|
||||
"severity": "warning"
|
||||
},
|
||||
{
|
||||
"rule": "applications.app_type = \"sneck\" && application_metrics.metric = \"check_ipmi_psu\" && application_metrics.value = \"2\"",
|
||||
"name": "Sneck - IPMI PSU Critical",
|
||||
"severity": "critical"
|
||||
},
|
||||
{
|
||||
"rule": "applications.app_type = \"sneck\" && application_metrics.metric = \"check_ipmi_psu\" && application_metrics.value = \"3\"",
|
||||
"name": "Sneck - IPMI PSU Unknown",
|
||||
"severity": "critical"
|
||||
},
|
||||
{
|
||||
"rule": "applications.app_type = \"sneck\" && application_metrics.metric = \"check_ipmi_fan\" && application_metrics.value = \"1\"",
|
||||
"name": "Sneck - IPMI Fan Warning",
|
||||
"severity": "warning"
|
||||
},
|
||||
{
|
||||
"rule": "applications.app_type = \"sneck\" && application_metrics.metric = \"check_ipmi_fan\" && application_metrics.value = \"2\"",
|
||||
"name": "Sneck - IPMI Fan Critical",
|
||||
"severity": "critical"
|
||||
},
|
||||
{
|
||||
"rule": "applications.app_type = \"sneck\" && application_metrics.metric = \"check_ipmi_fan\" && application_metrics.value = \"3\"",
|
||||
"name": "Sneck - IPMI Fan Unknown",
|
||||
"severity": "critical"
|
||||
},
|
||||
{
|
||||
"rule": "applications.app_type = \"sneck\" && application_metrics.metric = \"check_ipmi_temp\" && application_metrics.value = \"1\"",
|
||||
"name": "Sneck - IPMI Temperature Warning",
|
||||
"severity": "warning"
|
||||
},
|
||||
{
|
||||
"rule": "applications.app_type = \"sneck\" && application_metrics.metric = \"check_ipmi_temp\" && application_metrics.value = \"2\"",
|
||||
"name": "Sneck - IPMI Temperature Critical",
|
||||
"severity": "critical"
|
||||
},
|
||||
{
|
||||
"rule": "applications.app_type = \"sneck\" && application_metrics.metric = \"check_ipmi_temp\" && application_metrics.value = \"3\"",
|
||||
"name": "Sneck - IPMI Temperature Unknown",
|
||||
"severity": "critical"
|
||||
},
|
||||
{
|
||||
"rule": "applications.app_type = \"sneck\" && application_metrics.metric = \"check_ipmi_volts\" && application_metrics.value = \"1\"",
|
||||
"name": "Sneck - IPMI Volts Warning",
|
||||
"severity": "warning"
|
||||
},
|
||||
{
|
||||
"rule": "applications.app_type = \"sneck\" && application_metrics.metric = \"check_ipmi_volts\" && application_metrics.value = \"2\"",
|
||||
"name": "Sneck - IPMI Volts Critical",
|
||||
"severity": "critical"
|
||||
},
|
||||
{
|
||||
"rule": "applications.app_type = \"sneck\" && application_metrics.metric = \"check_ipmi_volts\" && application_metrics.value = \"3\"",
|
||||
"name": "Sneck - IPMI Volts Unknown",
|
||||
"severity": "critical"
|
||||
},
|
||||
{
|
||||
"rule": "applications.app_type = \"sneck\" && application_metrics.metric = \"check_ipmi_amps\" && application_metrics.value = \"1\"",
|
||||
"name": "Sneck - IPMI Amps Warning",
|
||||
"severity": "warning"
|
||||
},
|
||||
{
|
||||
"rule": "applications.app_type = \"sneck\" && application_metrics.metric = \"check_ipmi_amps\" && application_metrics.value = \"2\"",
|
||||
"name": "Sneck - IPMI Amps Critical",
|
||||
"severity": "critical"
|
||||
},
|
||||
{
|
||||
"rule": "applications.app_type = \"sneck\" && application_metrics.metric = \"check_ipmi_amps\" && application_metrics.value = \"3\"",
|
||||
"name": "Sneck - IPMI Amps Unknown",
|
||||
"severity": "critical"
|
||||
},
|
||||
{
|
||||
"rule": "applications.app_type = \"sneck\" && application_metrics.metric = \"check_suricata_procs\" && application_metrics.value != \"0\"",
|
||||
"name": "Sneck - Wrong Number Of Suricata Procs Running",
|
||||
"severity": "critical"
|
||||
},
|
||||
{
|
||||
"rule": "applications.app_type = \"sneck\" && application_metrics.metric = \"check_meer_procs\" && application_metrics.value != \"0\"",
|
||||
"name": "Sneck - Wrong Number Of Meer Procs Running",
|
||||
"severity": "critical"
|
||||
},
|
||||
{
|
||||
"rule": "applications.app_type = \"sneck\" && application_metrics.metric = \"check_sagan_procs\" && application_metrics.value != \"0\"",
|
||||
"name": "Sneck - Wrong Number Of Sagan Procs Running",
|
||||
"severity": "critical"
|
||||
},
|
||||
{
|
||||
"rule": "applications.app_type = \"sneck\" && application_metrics.metric = \"check_daemonlogger_procs\" && application_metrics.value != \"0\"",
|
||||
"name": "Sneck - Wrong Number Of Daemonlogger Procs Running",
|
||||
"severity": "critical"
|
||||
},
|
||||
{
|
||||
"rule": "applications.app_type = \"sneck\" && application_metrics.metric = \"time_to_polling_abs\" && application_metrics.value >= \"540\"",
|
||||
"name": "Sneck Has Not Run For Over 540 Seconds",
|
||||
"severity": "critical"
|
||||
},
|
||||
{
|
||||
"rule": "applications.app_type = \"suricata\" && application_metrics.metric = \"alert\" && application_metrics.value = \"1\"",
|
||||
"name": "Suricata has a WARNING alert",
|
||||
|
@@ -359,6 +359,10 @@
|
||||
"default": 8082,
|
||||
"type": "integer"
|
||||
},
|
||||
"apps.sneck.polling_time_diff": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"astext": {
|
||||
"default": {
|
||||
"65332": "Cymru FullBogon Feed",
|
||||
|
122
tests/data/linux_sneck-v1.json
Normal file
122
tests/data/linux_sneck-v1.json
Normal file
@@ -0,0 +1,122 @@
|
||||
{
|
||||
"applications": {
|
||||
"discovery": {
|
||||
"applications": [
|
||||
{
|
||||
"app_type": "sneck",
|
||||
"app_state": "UNKNOWN",
|
||||
"discovered": 1,
|
||||
"app_state_prev": null,
|
||||
"app_status": "",
|
||||
"app_instance": "",
|
||||
"data": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"poller": {
|
||||
"applications": [
|
||||
{
|
||||
"app_type": "sneck",
|
||||
"app_state": "OK",
|
||||
"discovered": 1,
|
||||
"app_state_prev": "UNKNOWN",
|
||||
"app_status": "",
|
||||
"app_instance": "",
|
||||
"data": "{\"data\":{\"alert\":0,\"alertString\":\"\",\"checks\":{\"clamav\":{\"check\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_clamav -w 2 -c 3\",\"exit\":0,\"output\":\"ClamAV OK: daily.cvd 26579 (Tue Jun 21 08:15:30 2022) is up to date\",\"ran\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_clamav -w 2 -c 3\"},\"entropy\":{\"check\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_entropy\",\"exit\":0,\"output\":\"OK: 3649 bytes in the pool.|entropy=3649 bytes\",\"ran\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_entropy\"},\"http\":{\"check\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_http -H 127.0.0.1:8000\",\"exit\":0,\"output\":\"HTTP OK: HTTP\\/1.1 200 OK - 6249 bytes in 0.057 second response time |time=0.057237s;;;0.000000;10.000000 size=6249B;;;0\",\"ran\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_http -H 127.0.0.1:8000\"},\"ipmi_sensor\":{\"check\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_ipmi_sensor --nosel\",\"exit\":0,\"output\":\"IPMI Status: OK | 'CPU Temp'=50.00;0.00:97.00;0.00:102.00 'System Temp'=37.00;0.00:80.00;-5.00:85.00 'Peripheral Temp'=47.00;0.00:80.00;-5.00:85.00 'DIMMB1 Temp'=36.00;5.00:80.00;0.00:85.00 'DIMMB2 Temp'=38.00;5.00:80.00;0.00:85.00 'FAN1'=4100.00;700.00:25300.00;500.00:25400.00 'FAN2'=3400.00;700.00:25300.00;500.00:25400.00 'FAN3'=4300.00;700.00:25300.00;500.00:25400.00 'VCCP'=1.86;1.57:2.02;1.46:2.13 'VDIMM'=1.20;1.05:1.34;0.97:1.43 '12V'=12.13;10.78:12.96;10.27:13.28 '5VCC'=5.03;4.48:5.39;4.30:5.55 '3.3VCC'=3.40;2.96:3.55;2.82:3.66 'VBAT'=3.14;2.59:3.49;2.47:3.57 '5V Dual'=5.00;4.49:5.38;4.30:5.54 '3.3V AUX'=3.32;2.96:3.55;2.82:3.66\",\"ran\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_ipmi_sensor --nosel\"},\"mongodb\":{\"check\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_mongodb.py\",\"exit\":0,\"output\":\"OK - Connection took 0.011 seconds\",\"ran\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_mongodb.py\"},\"raid\":{\"check\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_raid\",\"exit\":0,\"output\":\"OK: mdstat:[md0(2.73 TiB raid1):UU]\",\"ran\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_raid\"},\"virtqemud_procs\":{\"check\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_procs --ereg-argument-array '^\\/usr\\/sbin\\/virtqemud' 1:2\",\"exit\":0,\"output\":\"PROCS OK: 1 process with regex args '^\\/usr\\/sbin\\/virtqemud' | procs=1;1:2;;0;\",\"ran\":\"\\/usr\\/lib\\/nagios\\/plugins\\/check_procs --ereg-argument-array '^\\/usr\\/sbin\\/virtqemud' 1:2\"}},\"critical\":0,\"errored\":0,\"hostname\":\"nagi\",\"ok\":7,\"time\":1655835901,\"unknown\":0,\"vars\":[],\"warning\":0},\"error\":0,\"errorString\":\"\",\"version\":1}"
|
||||
}
|
||||
],
|
||||
"application_metrics": [
|
||||
{
|
||||
"metric": "check_clamav",
|
||||
"value": 0.0,
|
||||
"value_prev": null,
|
||||
"app_type": "sneck"
|
||||
},
|
||||
{
|
||||
"metric": "check_entropy",
|
||||
"value": 0.0,
|
||||
"value_prev": null,
|
||||
"app_type": "sneck"
|
||||
},
|
||||
{
|
||||
"metric": "check_http",
|
||||
"value": 0.0,
|
||||
"value_prev": null,
|
||||
"app_type": "sneck"
|
||||
},
|
||||
{
|
||||
"metric": "check_ipmi_sensor",
|
||||
"value": 0.0,
|
||||
"value_prev": null,
|
||||
"app_type": "sneck"
|
||||
},
|
||||
{
|
||||
"metric": "check_mongodb",
|
||||
"value": 0.0,
|
||||
"value_prev": null,
|
||||
"app_type": "sneck"
|
||||
},
|
||||
{
|
||||
"metric": "check_raid",
|
||||
"value": 0.0,
|
||||
"value_prev": null,
|
||||
"app_type": "sneck"
|
||||
},
|
||||
{
|
||||
"metric": "check_virtqemud_procs",
|
||||
"value": 0.0,
|
||||
"value_prev": null,
|
||||
"app_type": "sneck"
|
||||
},
|
||||
{
|
||||
"metric": "critical",
|
||||
"value": 0,
|
||||
"value_prev": null,
|
||||
"app_type": "sneck"
|
||||
},
|
||||
{
|
||||
"metric": "errored",
|
||||
"value": 0,
|
||||
"value_prev": null,
|
||||
"app_type": "sneck"
|
||||
},
|
||||
{
|
||||
"metric": "ok",
|
||||
"value": 7,
|
||||
"value_prev": null,
|
||||
"app_type": "sneck"
|
||||
},
|
||||
{
|
||||
"metric": "time",
|
||||
"value": 1655835901,
|
||||
"value_prev": null,
|
||||
"app_type": "sneck"
|
||||
},
|
||||
{
|
||||
"metric": "time_to_polling",
|
||||
"value": 0,
|
||||
"value_prev": null,
|
||||
"app_type": "sneck"
|
||||
},
|
||||
{
|
||||
"metric": "time_to_polling_abs",
|
||||
"value": 0,
|
||||
"value_prev": null,
|
||||
"app_type": "sneck"
|
||||
},
|
||||
{
|
||||
"metric": "unknown",
|
||||
"value": 0,
|
||||
"value_prev": null,
|
||||
"app_type": "sneck"
|
||||
},
|
||||
{
|
||||
"metric": "warning",
|
||||
"value": 0,
|
||||
"value_prev": null,
|
||||
"app_type": "sneck"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
10
tests/snmpsim/linux_sneck-v1.snmprec
Normal file
10
tests/snmpsim/linux_sneck-v1.snmprec
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user