summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2011-12-06 00:00:46 -0500
committerEliot Horowitz <eliot@10gen.com>2011-12-06 00:00:46 -0500
commitd47b0d51084265fd516ac8dad11e6d49fae078c4 (patch)
tree62881f143ee9dc0fc9107208ca2f3db36c01b6ab /tools
parent2f166e0b30ed774a5612369ab238e89eb1e55851 (diff)
downloadmongo-d47b0d51084265fd516ac8dad11e6d49fae078c4.tar.gz
mongostat handles arbiters and recovering nodes better
Diffstat (limited to 'tools')
-rw-r--r--tools/stat_util.cpp18
-rw-r--r--tools/stat_util.h2
2 files changed, 19 insertions, 1 deletions
diff --git a/tools/stat_util.cpp b/tools/stat_util.cpp
index cbf4fbfa126..38f780e8734 100644
--- a/tools/stat_util.cpp
+++ b/tools/stat_util.cpp
@@ -31,6 +31,18 @@ namespace mongo {
}
+ bool StatUtil::_in( const BSONElement& me , const BSONElement& arr ) {
+ if ( me.type() != String || arr.type() != Array )
+ return false;
+
+ string s = me.String();
+ BSONForEach(e, arr.Obj()) {
+ if ( e.type() == String && s == e.String() )
+ return true;
+ }
+ return false;
+ }
+
BSONObj StatUtil::doRow( const BSONObj& a , const BSONObj& b ) {
BSONObjBuilder result;
@@ -155,7 +167,11 @@ namespace mongo {
ss << "SEC";
else if ( x["isreplicaset"].trueValue() )
ss << "REC";
- else if ( isReplSet )
+ else if ( x["arbiterOnly"].trueValue() )
+ ss << "ARB";
+ else if ( _in( x["me"] , x["passives"] ) )
+ ss << "PSV";
+ else if ( isReplSet )
ss << "UNK";
else
ss << "SLV";
diff --git a/tools/stat_util.h b/tools/stat_util.h
index c498356c266..4990e91624c 100644
--- a/tools/stat_util.h
+++ b/tools/stat_util.h
@@ -64,6 +64,8 @@ namespace mongo {
result.append( name , BSON( "width" << (int)width << "data" << t ) );
}
+ bool _in( const BSONElement& me , const BSONElement& arr );
+
// -------