mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-21 05:45:13 +00:00
46 lines
1.1 KiB
Text
46 lines
1.1 KiB
Text
![]() |
#!/usr/bin/env python
|
||
|
# -*- coding: utf-8 -*-
|
||
|
|
||
|
from munin.mongodb import MuninMongoDBPlugin
|
||
|
|
||
|
class MongoDBSizePlugin(MuninMongoDBPlugin):
|
||
|
args = "-l 0 --base 1024"
|
||
|
vlabel = "bytes"
|
||
|
info = "Size of database"
|
||
|
dbname_in_args = True
|
||
|
fields = (
|
||
|
('storagesize', dict(
|
||
|
label = "Storage size (bytes)",
|
||
|
info = "Storage size",
|
||
|
type = "GAUGE",
|
||
|
draw = "AREA",
|
||
|
)),
|
||
|
('datasize', dict(
|
||
|
label = "Data size (bytes)",
|
||
|
info = "Data size",
|
||
|
type = "GAUGE",
|
||
|
draw = "AREA",
|
||
|
)),
|
||
|
('indexsize', dict(
|
||
|
label = "Index size (bytes)",
|
||
|
info = "Index size",
|
||
|
type = "GAUGE",
|
||
|
draw = "AREA",
|
||
|
)),
|
||
|
)
|
||
|
|
||
|
@property
|
||
|
def title(self):
|
||
|
return "MongoDB size of database %s" % self.dbname
|
||
|
|
||
|
def execute(self):
|
||
|
stats = self.db.command("dbstats")
|
||
|
return dict(
|
||
|
storagesize = stats["storageSize"],
|
||
|
datasize = stats["dataSize"],
|
||
|
indexsize = stats["indexSize"],
|
||
|
)
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
MongoDBSizePlugin().run()
|