Created
November 13, 2012 09:25
-
-
Save ryanchapman/4064825 to your computer and use it in GitHub Desktop.
Nagios nsca incoming statistics
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
mmdd=`date | sed 's|^\(... \)\(... ..\)\( ..:..:.. ... ....\)|\2|'`; hour=`date +%H`; echo; echo -n "Number of hosts sending us nsca results: "; cat /var/log/messages | egrep 'START:.*from=' | sed 's|\(.*from=\)\(.*\..*\..*\..*\)$|\2|g' | sort -u | wc -l; echo " ATTEMPTS/MIN FAILS/MIN"; min=0; while [ $min -lt 61 ]; do min_formatted=`printf "%2.2d" $min`; echo -n "${mmdd} ${hour}:${min_formatted} "; printf "%8.8s" `cat /var/log/messages | grep 'START: nsca pid=' | grep "${mmdd} ${hour}:${min_formatted}:" | wc -l`; printf " %8.8s\n" `cat /var/log/messages | grep 'FAIL: nsca' | grep "${mmdd} ${hour}:${min_formatted}:" | wc -l`;min=$((min+1)); done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Shows stats for nsca (passive nagios results) coming into a server. Output looks like: