mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-05 16:58:59 +00:00
30 lines
790 B
Text
30 lines
790 B
Text
![]() |
#!/srv/newsblur/venv/newsblur/bin/python
|
||
|
# -*- coding: utf-8 -*-
|
||
|
|
||
|
from vendor.munin.mongodb import MuninMongoDBPlugin
|
||
|
|
||
|
class MongoDBConnectionsPlugin(MuninMongoDBPlugin):
|
||
|
args = "-l 0 --base 1024"
|
||
|
vlabel = "bytes"
|
||
|
title = "MongoDB current connections"
|
||
|
info = "Current connections"
|
||
|
fields = (
|
||
|
('connections', dict(
|
||
|
label = "# of Connections",
|
||
|
info = "connections",
|
||
|
type = "GAUGE",
|
||
|
min = "0",
|
||
|
)),
|
||
|
)
|
||
|
|
||
|
def execute(self):
|
||
|
status = self.connection.admin.command('serverStatus')
|
||
|
try:
|
||
|
value = status['connections']['current']
|
||
|
except KeyError:
|
||
|
value = "U"
|
||
|
return dict(heap_usage=value)
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
MongoDBConnectionsPlugin().run()
|