Chinaunix首页 | 论坛 | 博客
  • 博客访问: 10060
  • 博文数量: 4
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 40
  • 用 户 组: 普通用户
  • 注册时间: 2014-11-27 23:22
文章分类

全部博文(4)

文章存档

2015年(4)

我的朋友
最近访客

分类: 系统运维

2015-08-17 13:11:16

根据网上找的资源,最新整理了以下
version:2.6
#!/bin/bash
user="root"
pw="p3temp"
case $1 in
     server )
 a=`ps -ef | grep mongo |grep -v grep |wc -l`
 echo $a;;
     men_resident )
      b=`echo "db.serverStatus().mem"| mongo admin -u$user -p$pw |grep resident | cut -d ":" -f 2 |cut -d "," -f 1| cut -d " " -f 2`
 echo $b;;
     mem_virtual )
 c=`echo "db.serverStatus().mem"| mongo admin -u$user -p$pw |grep virtual | cut -d ":" -f 2 |cut -d "," -f 1| cut -d " " -f 2`
 echo $c;;
     mem_mapped )
 d=`echo "db.serverStatus().mem"| mongo admin -u$user -p$pw |grep '\bmapped\b' | cut -d ":" -f 2 |cut -d "," -f 1| cut -d " " -f 2`
 echo $d;;
     index_accesses )
 e=`echo "db.serverStatus().indexCounters"| mongo admin -u$user -p$pw  | grep accesses| cut -d ":" -f 2 |cut -d "," -f1 |cut -d " " -f 2`
 echo $e;;
     index_hits )
 f=`echi "db.serverStatus().indexCounters"|mongo admin -u$user -p$pw | grep hits| cut -d ":" -f 2 |cut -d "," -f1 |cut -d " " -f 2`
 echo $f;;
     index_misses )
 g=`echo "db.serverStatus().indexCounters"|  mongo admin -u$user -p$pw | grep misses| cut -d ":" -f 2 |cut -d "," -f1 |cut -d " " -f 2`
 echo $g;;
     index_resets )
 h=`echo "db.serverStatus().indexCounters"|  mongo admin -u$user -p$pw | grep resets | cut -d ":" -f 2 |cut -d "," -f1 |cut -d " " -f 2`
 echo $h;;
     index_missRatio )
 i=`echo "db.serverStatus().indexCounters"|  mongo admin -u$user -p$pw | grep missRatio | cut -d ":" -f 2 |cut -d "," -f1 |cut -d " " -f 2`
 echo $i
     network_bytesIn )
 j=`echo "db.serverStatus().network"|mongo admin -u$user -p$pw | grep bytesIn | awk -F"[{}]" '{print $2}' | awk -F"[:, ]" '{print $5}'`
 echo $j;;
     network_bytesOut )
 k=`echo "db.serverStatus().network"|mongo admin  -u$user -p$pw | grep bytesIn | awk -F"[{}]" '{print $2}' | awk -F"[:, ]" '{print $10}'`
 echo $k;;
     network_numRequests )
 l=`echo "db.serverStatus().network"|mongo admin  -u$user -p$pw | grep bytesIn | awk -F"[{}]" '{print $2}' | awk -F"[:, ]" '{print $15}'`
 echo $l;;
 connections_current )
      a1=`echo "db.serverStatus().connections" | mongo admin -uroot -pp3temp | grep current | awk -F"[:, ]" '{print $5}'`
 echo $a1;;
 connections_available )
 a2=`echo "db.serverStatus().connections" | mongo admin -uroot -pp3temp | grep current | awk -F"[:, ]" '{print $10}'`
 echo $a2;;
 connections_NumberLong )
 a3=`echo "db.serverStatus().connections" | mongo admin -uroot -pp3temp | grep current | awk -F"[:, ()]" '{print $16}'`
 echo $a3;;
esac
exit 0

阅读(1139) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~