summaryrefslogtreecommitdiff
path: root/s
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2011-08-05 17:54:15 -0400
committerMathias Stearn <mathias@10gen.com>2011-08-08 12:44:52 -0400
commitdd520e59a580764cf73eef813f37a45dfeab016f (patch)
tree7d4ac25f7d80fa3e2e60418ecbb27836a4f9b49d /s
parent7ca73907386ff3385f47b3e46858f17ef5a14e59 (diff)
downloadmongo-dd520e59a580764cf73eef813f37a45dfeab016f.tar.gz
Add "warnings" RamLog and field in serverStatus. Use for full disk warnings. SERVER-3323
Diffstat (limited to 's')
-rw-r--r--s/commands_admin.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/s/commands_admin.cpp b/s/commands_admin.cpp
index 643e35cebb6..6d3e398370c 100644
--- a/s/commands_admin.cpp
+++ b/s/commands_admin.cpp
@@ -45,6 +45,7 @@
#include "stats.h"
#include "writeback_listener.h"
#include "client.h"
+#include "../util/ramlog.h"
namespace mongo {
@@ -177,6 +178,20 @@ namespace mongo {
bb.done();
}
+ {
+ RamLog* rl = RamLog::get( "warnings" );
+ verify(15879, rl);
+
+ if (rl->lastWrite() >= time(0)-(10*60)){ // only show warnings from last 10 minutes
+ vector<const char*> lines;
+ rl->get( lines );
+
+ BSONArrayBuilder arr( result.subarrayStart( "warnings" ) );
+ for ( unsigned i=std::max(0,(int)lines.size()-10); i<lines.size(); i++ )
+ arr.append( lines[i] );
+ arr.done();
+ }
+ }
return 1;
}