I am monitoring MySQL (MariaDB) using the check_mk_agent. I’m getting data in my graphs, so I know this is working fine.
However - I would like to setup an alert if MySQL goes down on the device/host. I’ve tried some things but am not having luck. I’m hoping someone has some advice?
I see librenms.applications has a field for app_state (and app_type = mysql)… I can even see app_state toggle from ‘OK’ to ‘UNKNOWN’ (if I manually shut-down mysql on my test device/host). However no alerts are getting generated (I do have a valid transport set too for notifications, even so the alert doesn’t show on the device page in LibreNMS).
Here’s the SQL I have in my rule:
SELECT * FROM devices,applications WHERE (devices.device_id = ? AND devices.device_id = applications.device_id) AND applications.app_state != "OK" AND applications.app_type = "mysql"
-bash-4.2$ php validate.php
Component Version LibreNMS 1.70.1 DB Schema 2020_11_02_164331_add_powerstate_enum_to_vminfo (191) PHP 7.3.18 Python 3.6.8 MySQL 5.5.65-MariaDB RRDTool 1.7.2 SNMP NET-SNMP 5.7.2 OpenSSL
[OK] Composer Version: 2.0.8
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
[WARN] IPv6 is disabled on your server, you will not be able to add IPv6 devices.
Thanks in advance for any advice.