Mini Shell

Direktori : /opt/sharedrads/
Upload File :
Current File : //opt/sharedrads/check_user

#!/bin/bash
# Shared RADS Tools, written by Erik Soroka (eriks@imhadmin.net, ext 834)
# This tool reports all pertinent data on a particular user for RA review.

CHECKUSER=$1

if [ -d /opt/sharedrads ]; then
    RADS_ROOT=/opt/sharedrads
else
    RADS_ROOT=/opt/dedrads
fi

#no user name received, no plaintext flag received
if [ -z $1 ]; then
	#no username argument received, lets show all server data
	echo ; $RADS_ROOT/check_server
	exit 0
fi

#no user received, but plaintext flag is present
if [ "$1" == "--plaintext" ]; then
	#no username argument received, lets show all server data
	echo ; $RADS_ROOT/check_server | sed -r "s:\x1B\[[0-9;]*[mK]::g"
	exit 0
fi


if [ "$2" == "--plaintext" ]; then
	RADSCOLORS=off
fi

echo

#load functions	+ banners
source $RADS_ROOT/radsfunctions.sh

if [ "$RADSCOLORS" == "off" ]; then
	radsbanner-nocolor
else
	radsbanner
fi

#SET A UNIQUE SESSION ID
SESSIONID=`date +%s`

if [ "$RADSCOLORS" == "off" ]; then

#check CPU
$RADS_ROOT/check_cpu $CHECKUSER $SESSIONID | sed -r "s:\x1B\[[0-9;]*[mK]::g"
#check dcpumon
$RADS_ROOT/check_dcpumon $CHECKUSER $SESSIONID | sed -r "s:\x1B\[[0-9;]*[mK]::g"
#check crons
$RADS_ROOT/check_crons $CHECKUSER $SESSIONID | sed -r "s:\x1B\[[0-9;]*[mK]::g"
#check mySQL slow queries
tail -10000 /var/log/slowqueries | $RADS_ROOT/mysql/slowqueryparser.py 2>&1 | awk "\$1 ~ /USER|$CHECKUSER/"
#check bandwidth
$RADS_ROOT/check_bandwidth $CHECKUSER $SESSIONID | sed -r "s:\x1B\[[0-9;]*[mK]::g"

else

#check CPU
$RADS_ROOT/check_cpu $CHECKUSER $SESSIONID
#check dcpumon
$RADS_ROOT/check_dcpumon $CHECKUSER $SESSIONID
#check crons
$RADS_ROOT/check_crons $CHECKUSER $SESSIONID
#check mySQL slow queries if on shared
[ -d /opt/sharedrads ] && tail -10000 /var/log/slowqueries | $RADS_ROOT/mysql/slowqueryparser.py 2>&1 | awk "\$1 ~ /USER|$CHECKUSER/"
#check bandwidth
$RADS_ROOT/check_bandwidth $CHECKUSER $SESSIONID

fi

Zerion Mini Shell 1.0