Last active
July 29, 2022 10:00
-
-
Save centminmod/7d3e562fb87fa8ef263a to your computer and use it in GitHub Desktop.
redis server info and stats for Centmin Mod installs centminmod.com. If redis password is set in /etc/redis.conf, edit the variable REDISPASSWORD='your_redis_password'
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 | |
VER=0.0.2 | |
######################################################### | |
# redis server info script for CentminMod.com | |
# written by George Liu (eva2000) vbtechsupport.com | |
######################################################### | |
# redis password set by requirepass in /etc/redis.conf | |
REDISPASSWORD='' | |
SOCKET=n | |
TRINSICTIME=10 | |
######################################################### | |
if [[ "$SOCKET" = [yY] ]]; then | |
SOPT=' -s /tmp/redis.sock' | |
else | |
SOPT="" | |
fi | |
# if [[ -z "$REDISPASSWORD" && "$SOCKET" = [nN] ]]; then | |
if [[ -z "$REDISPASSWORD" ]]; then | |
RPASS="" | |
else | |
RPASS=" -a $REDISPASSWORD" | |
fi | |
######################################################### | |
RPID=$(redis-cli${RPASS}${SOPT} info | awk -F ":" '/process_id/ {print $2}') | |
######################################################### | |
# Setup Colours | |
black='\E[30;40m' | |
red='\E[31;40m' | |
green='\E[32;40m' | |
yellow='\E[33;40m' | |
blue='\E[34;40m' | |
magenta='\E[35;40m' | |
cyan='\E[36;40m' | |
white='\E[37;40m' | |
boldblack='\E[1;30;40m' | |
boldred='\E[1;31;40m' | |
boldgreen='\E[1;32;40m' | |
boldyellow='\E[1;33;40m' | |
boldblue='\E[1;34;40m' | |
boldmagenta='\E[1;35;40m' | |
boldcyan='\E[1;36;40m' | |
boldwhite='\E[1;37;40m' | |
Reset="tput sgr0" # Reset text attributes to normal | |
#+ without clearing screen. | |
cecho () # Coloured-echo. | |
# Argument $1 = message | |
# Argument $2 = color | |
{ | |
message=$1 | |
color=$2 | |
echo -e "$color$message" ; $Reset | |
return | |
} | |
######################################################### | |
# functions | |
smeminstall() { | |
if [[ ! -f /usr/bin/smem ]]; then | |
cd /usr/local/src | |
wget -cnv http://centminmod.com/smem/smem-1.4.tar.gz | |
tar xzf smem-1.4.tar.gz | |
cp smem /usr/bin | |
chmod 0700 /usr/bin/smem | |
rm -rf ../smem-1* | |
fi | |
} | |
######################################################### | |
smeminstall | |
cecho "--------------------------------------------------------------------------" $boldgreen | |
redis-cli${RPASS}${SOPT} --version | |
cecho "--------------------------------------------------------------------------" $boldgreen | |
cecho "redis-cli${SOPT} info" $boldyellow | |
redis-cli${RPASS}${SOPT} info | |
echo | |
cecho "--------------------------------------------------------------------------" $boldgreen | |
cecho "redis-cli${SOPT} --intrinsic-latency $TRINSICTIME" $boldyellow | |
redis-cli${RPASS}${SOPT} --intrinsic-latency $TRINSICTIME | |
echo | |
cecho "--------------------------------------------------------------------------" $boldgreen | |
# echo | |
# cecho "--------------------------------------------------------------------------" $boldgreen | |
# cecho "redis-cli${SOPT} --latency-history" $boldyellow | |
# redis-cli${RPASS}${SOPT} --latency-history | |
# echo | |
# cecho "--------------------------------------------------------------------------" $boldgreen | |
cecho "vmstat 1 10" $boldyellow | |
vmstat 1 10 | |
cecho "--------------------------------------------------------------------------" $boldgreen | |
# cecho "cat /proc/${RPID}/smaps | grep '^Swap'" $boldyellow | |
# cat /proc/${RPID}/smaps | grep '^Swap' | |
# cecho "--------------------------------------------------------------------------" $boldgreen | |
# cecho "cat /proc/${RPID}/smaps | egrep '^Swap|^Size'" $boldyellow | |
# cat /proc/${RPID}/smaps | egrep '^Swap|^Size' | |
# cecho "--------------------------------------------------------------------------" $boldgreen | |
echo | |
cecho "smem -kU redis" $boldyellow | |
smem -kU redis | |
cecho "--------------------------------------------------------------------------" $boldgreen | |
echo | |
cecho "--------------------------------------------------------------------------" $boldgreen | |
cecho "smem -kmU redis" $boldyellow | |
smem -kmU redis | |
cecho "--------------------------------------------------------------------------" $boldgreen | |
echo | |
cecho "--------------------------------------------------------------------------" $boldgreen | |
cecho "smem -tpk" $boldyellow | |
smem -tpk | |
cecho "--------------------------------------------------------------------------" $boldgreen | |
echo | |
cecho "--------------------------------------------------------------------------" $boldgreen | |
cecho "free -mlt" $boldyellow | |
free -mlt | |
cecho "--------------------------------------------------------------------------" $boldgreen |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to install redisinfo.sh
If redis password is set in
/etc/redis.conf
, editredisinfo.sh
variableREDISPASSWORD='your_redis_password'
Run command
Sample script output below