mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-05 16:58:59 +00:00
29 lines
797 B
Python
Executable file
29 lines
797 B
Python
Executable file
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from vendor.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()
|