NewsBlur/config/munin/mongodb_lock_time
2011-12-02 16:22:38 -08:00

29 lines
790 B
Python
Executable file

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from munin.mongodb import MuninMongoDBPlugin
class MongoDBLockTime(MuninMongoDBPlugin):
args = "-l 0 --base 1000"
vlabel = "time"
title = "MongoDB global lock time"
info = "How long the global lock has been held"
fields = (
('locktime', dict(
label = "Global lock time",
info = "How long the global lock has been held",
type = "COUNTER",
min = "0",
)),
)
def execute(self):
status = self.connection.admin.command('serverStatus')
try:
value = int(status["globalLock"]["lockTime"])
except KeyError:
value = "U"
return dict(locktime=value)
if __name__ == "__main__":
MongoDBLockTime().run()