NewsBlur/config/munin/mongodb_size_newsblur

46 lines
1.2 KiB
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 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()