mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-05 16:58:59 +00:00
33 lines
792 B
Text
33 lines
792 B
Text
![]() |
#!/usr/bin/env python
|
||
|
# -*- coding: utf-8 -*-
|
||
|
|
||
|
from munin.mongodb import MuninMongoDBPlugin
|
||
|
|
||
|
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()
|