NewsBlur/config/munin/cassandra_pending
2016-11-11 11:09:13 -08:00

33 lines
917 B
Python
Executable file

#!/srv/newsblur/venv/newsblur/bin/python
import os
from vendor.munin.cassandra import MuninCassandraPlugin
class CassandraPendingPlugin(MuninCassandraPlugin):
title = "thread pool pending tasks"
args = "--base 1000 -l 0"
vlabel = "pending tasks"
scale = False
@property
def fields(self):
tpstats = self.tpstats()
fs = []
for name, stats in tpstats.items():
fs.append((name.lower().replace('-', '_'), dict(
label = name,
info = name,
type = "GAUGE",
min = "0",
)))
return fs
def execute(self):
tpstats = self.tpstats()
values = {}
for name, stats in tpstats.items():
values[name.lower().replace('-', '_')] = stats['pending']
return values
if __name__ == "__main__":
CassandraPendingPlugin().run()