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

@@ -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",

View File

@@ -359,6 +359,10 @@
"default": 8082,
"type": "integer"
},
"apps.sneck.polling_time_diff": {
"default": false,
"type": "boolean"
},
"astext": {
"default": {
"65332": "Cymru FullBogon Feed",