NewsBlur/archive/munin/mongodb_queues

33 lines
819 B
Text
Raw Normal View History

2020-12-03 14:05:32 -05:00
#!/srv/newsblur/venv/newsblur3/bin/python
2011-12-02 16:22:38 -08:00
# -*- coding: utf-8 -*-
2016-11-11 11:06:33 -08:00
from vendor.munin.mongodb import MuninMongoDBPlugin
2011-12-02 16:22:38 -08:00
class MongoDBQueuesPlugin(MuninMongoDBPlugin):
args = "-l 0 --base 1000"
vlabel = "count"
title = "MongoDB queues"
info = "Queues"
queues = ("readers", "writers")
@property
def fields(self):
return [
(q, dict(
label = "%s" % q,
info = "%s" % q,
type = "GAUGE",
min = "0",
)) for q in self.queues
]
def execute(self):
status = self.connection.admin.command('serverStatus')
return dict(
(q, status["globalLock"]["currentQueue"][q])
for q in self.queues
)
if __name__ == "__main__":
MongoDBQueuesPlugin().run()