| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 
 | cat mongo.sh
 #!/bin/bash
 
 case $1 in
 #  use_memory)
 #    used_memory=`echo "db.serverStatus().mem"|mongo admin|grep resident|awk -F':' '{print $2}'|tr -d " ,"`
 #    echo $used_memory
 #    ;;
 #
 #  use_vmemory)
 #    used_vmemory=`echo "db.serverStatus().mem"|mongo admin|grep virtual|awk -F':' '{print $2}'|tr -d " ,"`
 #    echo $used_vmemory
 #    ;;
 #
 #  used_conn)
 #    used_conn=`echo "db.serverStatus().connections"|mongo admin|grep current|awk -F':' '{print $2}'|tr -d ' ,'`
 #    echo $used_conn
 #    ;;
 #
 #  available_conn)
 #    available=`echo "db.serverStatus().connections"|mongo admin|grep available|awk -F':' '{print $2}'|tr -d ' ,'`
 #    echo $availabe
 #  ;;
 
 insert)
 insert=`mongostat -n1 | tail -n 1|awk '{print $1}'|tr -d ' *,'`
 echo $insert
 ;;
 
 query)
 query=`mongostat -n1 | tail -n 1|awk '{print $2}'|tr -d ' *,'`
 echo $query
 ;;
 
 update)
 update=`mongostat -n1 | tail -n 1|awk '{print $3}'|tr -d ' *,'`
 echo $update
 ;;
 
 delete)
 delete=`mongostat -n1 | tail -n 1|awk '{print $4}'|tr -d ' *,'`
 echo $delete
 ;;
 getmore)
 getmore=`mongostat -n1 | tail -n 1|awk '{print $5}'|tr -d ' *,'`
 echo $getmore
 ;;
 command)
 command=`mongostat -n1 | tail -n 1|awk '{print $6}'|awk -F'|' '{print $1}'|tr -d ' *,'`
 echo $command
 ;;
 vsize)
 vsize=`mongostat -n1 | tail -n 1|awk '{print $10}'|tr -d ' *,G'`
 echo $vsize
 ;;
 res)
 res=`mongostat -n1 | tail -n 1|awk '{print $11}'|tr -d ' *,G'`
 echo $res
 ;;
 qr)
 qr=`mongostat -n1 | tail -n 1|awk '{print $12}'|awk -F'|' '{print $1}'|tr -d ' *,'`
 echo $qr
 ;;
 qw)
 qw=`mongostat -n1 | tail -n 1|awk '{print $12}'|awk -F'|' '{print $2}'|tr -d ' *,'`
 echo $qw
 ;;
 ar)
 ar=`mongostat -n1 | tail -n 1|awk '{print $13}'|awk -F'|' '{print $1}'|tr -d ' *,'`
 echo $ar
 ;;
 aw)
 aw=`mongostat -n1 | tail -n 1|awk '{print $13}'|awk -F'|' '{print $2}'|tr -d ' *,'`
 echo $aw
 ;;
 conn)
 conn=`mongostat -n1 | tail -n 1|awk '{print $16}'|tr -d ' *,'`
 echo $conn
 ;;
 
 *)
 echo "please input  insert|query|update|delete"
 ;;
 esac
 
 |