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.

56 lines
1.9 KiB

  1. #!/usr/bin/python
  2. """
  3. * Copyright (C) 2009, Michael "Svedrin" Ziegler <diese-addy@funzt-halt.net>
  4. *
  5. * Mumble-Django is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This package is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. """
  15. # Set this to the same path you used in settings.py, or None for auto-detection.
  16. MUMBLE_DJANGO_ROOT = None;
  17. ### DO NOT CHANGE ANYTHING BELOW THIS LINE ###
  18. import os, sys
  19. from os.path import join, dirname, abspath, exists
  20. # Path auto-detection
  21. if not MUMBLE_DJANGO_ROOT or not exists( MUMBLE_DJANGO_ROOT ):
  22. MUMBLE_DJANGO_ROOT = dirname(abspath(__file__));
  23. # environment variables
  24. sys.path.append( MUMBLE_DJANGO_ROOT )
  25. sys.path.append( join( MUMBLE_DJANGO_ROOT, 'pyweb' ) )
  26. os.environ['DJANGO_SETTINGS_MODULE'] = 'pyweb.settings'
  27. # If you get an error about Python not being able to write to the Python
  28. # egg cache, the egg cache path might be set awkwardly. This should not
  29. # happen under normal circumstances, but every now and then, it does.
  30. # Uncomment this line to point the egg cache to /tmp.
  31. #os.environ['PYTHON_EGG_CACHE'] = '/tmp/pyeggs'
  32. from mumble.models import *
  33. mm = Mumble.objects.filter( booted = True ).order_by( "id" );
  34. if sys.argv[-1] == 'config':
  35. print "graph_vlabel Users"
  36. print "graph_args --base 1000"
  37. print "graph_title Mumble Users"
  38. print "graph_category network"
  39. for mumble in mm:
  40. print "%d.label %s" % ( mumble.id, mumble.name );
  41. else:
  42. for mumble in mm:
  43. print "%d.value %d" % ( mumble.id, len( mumble.ctl.getPlayers( mumble.srvid ) ) );