-
-
Save hflamboauto1/adcef9704b085cd2c2858f8e2f1ef574 to your computer and use it in GitHub Desktop.
Example bash script for a PRTG SSH script sensor - this one for MySQL slave to master checks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# query MySQL for slave replication status | |
# note: requires [~/.my.cnf] to be present a populated with valid MySQL password | |
mysql \ | |
-u root \ | |
-Be "SHOW GLOBAL STATUS LIKE 'Slave_running'" | \ | |
tail -n1 | grep -Pqe "^Slave_running\tON$" | |
if [ $? -eq 0 ]; then | |
# success | |
echo "0:100:Slave connected to master" | |
else | |
# failure | |
echo "2:0:Slave disconnected from master" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment