NewsBlur/utils/munin/newsblur_loadtimes.py

35 lines
927 B
Python
Raw Normal View History

2020-12-03 14:05:32 -05:00
#!/srv/newsblur/venv/newsblur3/bin/python
2020-12-10 12:40:12 -05:00
import os
2024-04-24 09:43:56 -04:00
2024-04-24 09:50:42 -04:00
from utils.munin.base import MuninGraph
os.environ["DJANGO_SETTINGS_MODULE"] = "newsblur_web.settings"
2020-12-10 12:42:12 -05:00
import django
2024-04-24 09:43:56 -04:00
2020-12-10 12:42:12 -05:00
django.setup()
2024-04-24 09:43:56 -04:00
class NBMuninGraph(MuninGraph):
@property
def graph_config(self):
return {
2024-04-24 09:43:56 -04:00
"graph_category": "NewsBlur",
"graph_title": "NewsBlur Loadtimes",
"graph_vlabel": "Loadtimes (seconds)",
"graph_args": "-l 0",
"feed_loadtimes_avg_hour.label": "Feed Loadtimes Avg (Hour)",
"feeds_loaded_hour.label": "Feeds Loaded (Hour)",
}
def calculate_metrics(self):
from apps.statistics.models import MStatistics
2024-04-24 09:43:56 -04:00
return {
2024-04-24 09:43:56 -04:00
"feed_loadtimes_avg_hour": MStatistics.get("latest_avg_time_taken"),
"feeds_loaded_hour": MStatistics.get("latest_sites_loaded"),
}
2024-04-24 09:43:56 -04:00
if __name__ == "__main__":
NBMuninGraph().run()