Created
March 4, 2017 17:04
-
-
Save DaffyDuke/324a75d80d08a0c3f12763df40c625e1 to your computer and use it in GitHub Desktop.
Nagios Plugin for dmesg Monitoring
This file contains 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 | |
# Source : http://lzone.de/blog/Nagios%20Plugin%20for%20dmesg%20Monitoring | |
SEVERITIES="err,alert,emerg,crit" | |
WHITELIST="microcode: |\ | |
Firmware Bug|\ | |
i8042: No controller|\ | |
Odd, counter constraints enabled but no core perfctrs detected|\ | |
Failed to access perfctr msr|\ | |
echo 0 > /proc/sys" | |
# Check for critical dmesg lines from this day | |
date=$(date "+%a %b %e") | |
output=$(dmesg -T -l "$SEVERITIES" | egrep -v "$WHITELIST" | grep "$date" | tail -5) | |
if [ "$output" == "" ]; then | |
echo "All is fine." | |
exit 0 | |
fi | |
echo "$output" | xargs | |
exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment