PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /proc/thread-self/root/proc/self/root/proc/self/root/opt/sharedrads/oldrads/mysql/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : //proc/thread-self/root/proc/self/root/proc/self/root/opt/sharedrads/oldrads/mysql/check_genq

#!/bin/bash
# This is a nagios plugin to check if general query logging has been left on
# Written by Erik S. (e@inmotion.net / ext 834)

#define our states
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
STATE_DEPENDENT=4

# Get local mysql version
fullversion=`mysqladmin -uimhnagios -p1mhN4g10z variables | grep " version " | awk '{print $4}'`

# Get major and minor version of mysql
majorv=`echo $fullversion | awk -F'.' '{print $1}'`
minorv=`echo $fullversion | awk -F'.' '{print $2}'`

# Determine running version and get the appropriate log variable
if [[ "$majorv" = "4" ]] || [[ "$majorv" = "5" && "$minorv" = "0" ]] ; then
    genq=`mysqladmin -uimhnagios -p1mhN4g10z  variables | grep " log " | awk '{print $4}'`
else
    genq=`mysqladmin -uimhnagios -p1mhN4g10z  variables | grep " general_log " | awk '{print $4}'`
fi

		if [ "$genq" == "ON" ]; then
			if [ -f /var/log/MySQLGenLog ]; then

				NOW=$(date +%s)
				START_TIME=$(stat --format=%X /var/log/MySQLGenLog)
		        	MINSOLD=`echo $START_TIME $NOW | awk '{ print ($2 - $1)/60 }'`
				MINSOLDINT=`echo $MINSOLD | cut -d. -f1`

		                if [ $MINSOLDINT -gt 60 ]; then
                                        echo "CRITICAL - mySQL general queries logging to disk for $MINSOLDINT minutes."
					exit $STATE_CRITICAL;

				else
                                        echo "WARNING - mySQL general queries logging to disk for $MINSOLDINT minutes."
					exit $STATE_WARNING;
				fi

			else
				echo "OK - General Query logging is enabled and writing to /dev/null"
				exit $STATE_OK;
			fi

 		else
			echo "OK - General Query logging is disabled from the mySQL server."
			exit $STATE_OK;
		fi