39 lines
1.1 KiB
Bash
39 lines
1.1 KiB
Bash
#!/bin/bash
|
||
|
||
################################生成日志文件########################################
|
||
if [ -f "/Log/Check_Container.csv" ];then
|
||
echo "Monitor File Exist!"
|
||
else
|
||
touch /Log/Check_Container.csv
|
||
fi
|
||
|
||
head_char_now=`sed -n '1p;1q' /Log/Check_Container.csv`
|
||
|
||
head_char_check="Ram_total"
|
||
|
||
if [[ $head_char_now == *$head_char_check* ]];then
|
||
echo "Character Exist!"
|
||
else
|
||
echo 'Time','Dedupname','Container num','Recycling container num'>> /Log/Check_Container.csv
|
||
fi
|
||
################################生成日志文件########################################
|
||
|
||
if [ $# -eq 0 ];then
|
||
echo "Input Dedupserver Name! "
|
||
exit 1
|
||
fi
|
||
|
||
dedupname=$1
|
||
|
||
dbname="${dedupname}containerdb"
|
||
cmd1="db.$dbname.find().count()"
|
||
cmd2="db.$dbname.find({container_sign:2}).count()"
|
||
|
||
getcontainer1=$(/opt/bksoft/ubackup/bin/mongo -uunary -pmonGo1223 dedup_db --eval ${cmd1} | awk 'END{print}')
|
||
getcontainer2=$(/opt/bksoft/ubackup/bin/mongo -uunary -pmonGo1223 dedup_db --eval ${cmd2} | awk 'END{print}')
|
||
|
||
#echo $getcontainer1
|
||
#echo $getcontainer2
|
||
time=$(date "+%Y-%m-%d %H:%M:%S")
|
||
echo "$time,$dedupname,$getcontainer1,$getcontainer2" >> /Log/Check_Container.csv
|