I've been trying to find a free way to monitor mysql status variables and push a slack notification when certain variables hit a threshold (ie: large number of connections).
At the moment, all the out-of-the-box solutions require massive monitoring tools setting up and some have a cost involved.
Surely its relatively easy just to write a script, but I'm unsure where would be the best place to start this. I'd imagine it would be a cron which would run every 5sec which would get the status variables, if they hit the threshold, call the webhook.
Can anyone make suggestions on the best approach to do this?
I realize that you want to resist monitoring tools, but you should maybe consider Percona Monitoring and Management, which is a totally free open source tool. You can set up alerting using Grafana, and one of the channel options for notifications is Slack. This is a regular requirement of the tool.
There are demonstration boards here that you should be able to review and use as a baseline for your own experiments? https://pmmdemo.percona.com/graph/dashboard/db/_alerting
Disclosure: I am a representative of Percona, but that doesn't mean it's not a genuinely good solution for you!