Browse Source

fix IDs to be compatible with Munin 1.4, display a bit more info in the graphs and allow stuff to be configured. fixes #77

Natenom/support-murmur-13-1446181288462
Michael Ziegler 15 years ago
parent
commit
84730737c7
  1. 19
      munin.py
  2. 9
      pyweb/settings.py

19
munin.py

@ -39,18 +39,29 @@ os.environ['DJANGO_SETTINGS_MODULE'] = 'pyweb.settings'
# Uncomment this line to point the egg cache to /tmp.
#os.environ['PYTHON_EGG_CACHE'] = '/tmp/pyeggs'
from django.conf import settings
from mumble.models import *
warn = getattr( settings, "MUNIN_WARNING", 0.80 )
crit = getattr( settings, "MUNIN_CRITICAL", 0.95 )
title = getattr( settings, "MUNIN_TITLE", "Mumble Users" )
categ = getattr( settings, "MUNIN_CATEGORY", "network" )
mm = Mumble.objects.filter( booted = True ).order_by( "id" );
if sys.argv[-1] == 'config':
print "graph_vlabel Users"
print "graph_args --base 1000"
print "graph_title Mumble Users"
print "graph_category network"
print "graph_title", title
print "graph_category", categ
for mumble in mm:
print "%d.label %s" % ( mumble.id, mumble.name.replace( '#', '' ) );
print "srv%d.label %s" % ( mumble.id, mumble.name.replace( '#', '' ) );
print "srv%d.info %s" % ( mumble.id, mumble.connecturl );
if mumble.users:
print "srv%d.warning %d" % ( mumble.id, int( mumble.users * warn ) );
print "srv%d.critical %d" % ( mumble.id, int( mumble.users * crit ) );
elif sys.argv[-1] == 'autoconf':
@ -69,5 +80,5 @@ elif sys.argv[-1] == 'autoconf':
else:
for mumble in mm:
print "%d.value %d" % ( mumble.id, len( mumble.ctl.getPlayers( mumble.srvid ) ) );
print "srv%d.value %d" % ( mumble.id, len( mumble.ctl.getPlayers( mumble.srvid ) ) );

9
pyweb/settings.py

@ -94,6 +94,15 @@ PROTECTED_MODE = False
ALLOW_ACCOUNT_LINKING = True # Allow linking in general?
ALLOW_ACCOUNT_LINKING_ADMINS = False # Allow linking for Admin accounts?
# Warning and Critical levels for the Munin plugin. These will be multiplied with the
# server instance's slot count to calculate the real levels.
MUNIN_WARNING = 0.80
MUNIN_CRITICAL = 0.95
# The graph title.
MUNIN_TITLE = 'Mumble Users'
# see <http://munin.projects.linpro.no/wiki/graph_category_list> for a list of valid categories.
MUNIN_CATEGORY = 'network'
# Database settings for Mumble-Django's database. These do NOT need to point to Murmur's database,
# Mumble-Django should use its own!
DATABASE_ENGINE = 'sqlite3'

Loading…
Cancel
Save