get authentic stats into munin graphs (#5205)

This commit is contained in:
Frédéric Péters 2014-07-23 19:31:37 +02:00
parent 441f51006f
commit 62435d6d19
2 changed files with 78 additions and 0 deletions

39
idp/munin/authentic_activity Executable file
View File

@ -0,0 +1,39 @@
#! /usr/bin/env python
import sys
import os
import json
STATS_PATH = '/var/lib/authentic2/static/stats.json'
if len(sys.argv) == 2 and sys.argv[1] == 'autoconf':
if os.path.exists(STATS_PATH):
print 'yes'
sys.exit(0)
else:
print 'no'
sys.exit(1)
stats = json.load(file(STATS_PATH))
graph_keys = []
for key in stats:
if key == 'active_federations':
continue
if not key.startswith('users_last'):
continue
graph_keys.append(key)
if len(sys.argv) == 2 and sys.argv[1] == 'config':
print 'graph_title Authentic activity'
print 'graph_category authentic'
print 'graph_args --lower-limit 0'
print 'graph_vlabel n'
print ''
for key in graph_keys:
print '%s.label %s' % (key, key)
sys.exit(0)
for key in graph_keys:
print '%s.value %s' % (key, stats.get(key))

39
idp/munin/authentic_users Executable file
View File

@ -0,0 +1,39 @@
#! /usr/bin/env python
import sys
import os
import json
STATS_PATH = '/var/lib/authentic2/static/stats.json'
if len(sys.argv) == 2 and sys.argv[1] == 'autoconf':
if os.path.exists(STATS_PATH):
print 'yes'
sys.exit(0)
else:
print 'no'
sys.exit(1)
stats = json.load(file(STATS_PATH))
graph_keys = []
for key in stats:
if key == 'active_federations':
continue
if key.startswith('users_last'):
continue
graph_keys.append(key)
if len(sys.argv) == 2 and sys.argv[1] == 'config':
print 'graph_title Authentic stats'
print 'graph_category authentic'
print 'graph_args --lower-limit 0'
print 'graph_vlabel n'
print ''
for key in graph_keys:
print '%s.label %s' % (key, key)
sys.exit(0)
for key in graph_keys:
print '%s.value %s' % (key, stats.get(key))