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