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,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"
}
]
}
}
}

File diff suppressed because one or more lines are too long