Forked mumble-django project from https://bitbucket.org/Svedrin/mumble-django
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.3 KiB

  1. #!/usr/bin/python
  2. # Set this to the same path you used in settings.py, or None for auto-detection.
  3. MUMBLE_DJANGO_ROOT = None;
  4. ### DO NOT CHANGE ANYTHING BELOW THIS LINE ###
  5. import os, sys
  6. from os.path import join, dirname, abspath, exists
  7. # Path auto-detection
  8. if not MUMBLE_DJANGO_ROOT or not exists( MUMBLE_DJANGO_ROOT ):
  9. MUMBLE_DJANGO_ROOT = dirname(abspath(__file__));
  10. # environment variables
  11. sys.path.append( MUMBLE_DJANGO_ROOT )
  12. sys.path.append( join( MUMBLE_DJANGO_ROOT, 'pyweb' ) )
  13. os.environ['DJANGO_SETTINGS_MODULE'] = 'pyweb.settings'
  14. # If you get an error about Python not being able to write to the Python
  15. # egg cache, the egg cache path might be set awkwardly. This should not
  16. # happen under normal circumstances, but every now and then, it does.
  17. # Uncomment this line to point the egg cache to /tmp.
  18. #os.environ['PYTHON_EGG_CACHE'] = '/tmp/pyeggs'
  19. from mumble.models import *
  20. mm = Mumble.objects.filter( booted = True )
  21. if sys.argv[-1] == 'config':
  22. print "graph_vlabel Users"
  23. print "graph_args --base 1000"
  24. print "graph_title Mumble Users"
  25. print "graph_category network"
  26. for mumble in mm:
  27. print "%d.label %s" % ( mumble.id, mumble.name );
  28. else:
  29. for mumble in mm:
  30. print "%d.value %d" % ( mumble.id, len( mumble.ctl.getPlayers( mumble.srvid ) ) );