自写简单Redis内存统计shell

#!/bin/bash
address="192.168.150.128:6666,192.168.150.128:6666"  
hosts=(${address//,/ })  

sfile="staticts.log"

for hostitem in ${hosts[@]}  
do  
    ipport=(${hostitem//:/ })  
    host=${ipport[0]}
    port=${ipport[1]}

    echo $host":"$port >> $sfile

    echo "dbsize:" >> $sfile
    redis-cli -h $host -p $port dbsize >> $sfile

    redis-cli -h $host -p $port info | grep used_memory:  >> $sfile


    redis-cli -h $host -p $port info | grep used_memory_human: >> $sfile


    redis-cli -h $host -p $port info | grep used_memory_peak:  >> $sfile


    redis-cli -h $host -p $port info | grep used_memory_peak_human:  >> $sfile


    echo -e "\n\n\n\n" >> $sfile
done  

 

你可能感兴趣的