2020-03-27 21:41:40 +01:00
Notify about health state
=========================
2024-03-06 14:30:18 +01:00
[](https://github.com/eworm-de/routeros-scripts/stargazers)
[](https://github.com/eworm-de/routeros-scripts/network)
[](https://github.com/eworm-de/routeros-scripts/watchers)
2025-02-07 17:39:48 +01:00
[](https://mikrotik.com/download/changelogs/)
2024-03-06 14:30:18 +01:00
[](https://t.me/routeros_scripts)
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick& hosted_button_id=A4ZXBD6YS2W8J)
2023-01-10 14:45:27 +01:00
[⬅️ Go back to main README ](../README.md )
2020-03-27 21:41:40 +01:00
2022-02-12 13:05:56 +01:00
> ℹ ️ **Info**: This script can not be used on its own but requires the base
2022-02-11 23:34:39 +01:00
> installation. See [main README](../README.md) for details.
2021-05-03 15:07:50 +02:00
2020-03-27 21:41:40 +01:00
Description
-----------
This script is run from scheduler periodically, sending notification on
2025-02-04 12:27:35 +01:00
health related events. Monitoring CPU and RAM utilization (available
processing and memory resources) works on all devices:
2020-03-27 21:41:40 +01:00
2023-02-14 20:09:41 +01:00
* high CPU utilization
2023-10-24 16:26:14 +02:00
* high RAM utilization (low available RAM)
2025-02-04 12:27:35 +01:00
With additional plugins functionality can be extended, depending on
sensors available in hardware:
2023-02-13 11:15:06 +01:00
* voltage jumps up or down more than configured threshold
* voltage drops below hard lower limit
2025-02-04 12:27:35 +01:00
* fan failed or recovered
2020-03-27 21:41:40 +01:00
* power supply failed or recovered
* temperature is above or below threshold
2025-02-03 14:35:47 +01:00
> ⚠️ **Warning**: Note that bad initial state will not trigger an event! For
> example rebooting a device that is already too hot will not trigger an
> alert on high temperature.
2021-06-17 15:23:51 +02:00
### Sample notifications
2023-02-14 20:09:41 +01:00
#### CPU utilization
2023-01-20 14:24:20 +01:00
2023-02-14 20:09:41 +01:00


2023-01-20 14:24:20 +01:00
2023-10-24 16:26:14 +02:00
#### RAM utilization (low available RAM)
2023-01-20 14:34:18 +01:00
2023-10-24 16:26:14 +02:00


2023-01-20 14:34:18 +01:00
2021-06-17 15:23:51 +02:00
#### Voltage
2023-01-20 14:34:18 +01:00

2021-06-17 15:23:51 +02:00
#### Temperature
2023-01-20 14:34:18 +01:00


2021-06-17 15:23:51 +02:00
#### PSU state
2025-02-04 12:27:35 +01:00


2021-06-17 15:23:51 +02:00
2020-03-27 21:41:40 +01:00
Requirements and installation
-----------------------------
Just install the script and create a scheduler:
$ScriptInstallUpdate check-health;
2023-03-31 17:45:55 +02:00
/system/scheduler/add interval=53s name=check-health on-event="/system/script/run check-health;" start-time=startup;
> ℹ ️ **Info**: Running lots of scripts simultaneously can tamper the
> precision of cpu utilization, escpecially on devices with limited
> resources. Thus an unusual interval is used here.
2020-03-27 21:41:40 +01:00
2025-02-04 12:27:35 +01:00
### Plugins
Additional plugins are available for sensors available in hardware. First
check what your hardware supports:
/system/health/print;
Then install the plugin for *fan* and *power supply unit* *state* :
$ScriptInstallUpdate check-health,check-health.d/state;
... or *temperature* :
$ScriptInstallUpdate check-health,check-health.d/temperature;
... or *voltage* :
$ScriptInstallUpdate check-health,check-health.d/voltage;
You can also combine the commands and install all or a subset of plugins
in one go:
$ScriptInstallUpdate check-health,check-health.d/state,check-health.d/temperature,check-health.d/voltage;
2020-03-27 21:41:40 +01:00
Configuration
-------------
2021-06-18 10:24:33 +02:00
The configuration goes to `global-config-overlay` , these are the parameters:
2020-03-27 21:41:40 +01:00
* `CheckHealthTemperature` : an array specifying temperature thresholds for sensors
2021-11-13 21:29:33 +01:00
* `CheckHealthVoltageLow` : value (in volt*10) giving a hard lower limit
2020-03-27 21:41:40 +01:00
* `CheckHealthVoltagePercent` : percentage value to trigger voltage jumps
2023-06-07 14:12:01 +02:00
> ℹ ️ **Info**: Copy relevant configuration from
> [`global-config`](../global-config.rsc) (the one without `-overlay`) to
> your local `global-config-overlay` and modify it to your specific needs.
2022-09-23 15:07:30 +02:00
Also notification settings are required for
[e-mail ](mod/notification-email.md ),
2025-03-04 17:21:00 +01:00
[gotify ](mod/notification-gotify.md ),
2023-10-11 07:40:55 +02:00
[matrix ](mod/notification-matrix.md ),
[ntfy ](mod/notification-ntfy.md ) and/or
2021-11-16 16:03:43 +01:00
[telegram ](mod/notification-telegram.md ).
2020-03-27 21:41:40 +01:00
---
2023-01-10 14:45:27 +01:00
[⬅️ Go back to main README ](../README.md )
[⬆️ Go back to top ](#top )