a couple of weeks ago i added the regioninfo REST call to OpenSim. here is a little python script that shows you how to use it:
[python]
#!/usr/bin/python
# -*- encoding: utf-8 -*-
import sys
import urllib2
import xml.etree.ElementTree as ET
def RegionInfo(url):
if not url.endswith('/'):
url = '%s/' % url
regionInfoUri = '%sadmin/regioninfo/' % url
print '== OpenSim server %s ==' % url
riXml = ET.parse(urllib2.urlopen(regionInfoUri)).getroot()
print 'regions (curr): %d' % int(riXml.attrib['number'])
print 'regions (max): %d' % int(riXml.attrib['max'])
totalAvatars = 0
totalObjects = 0
for region in riXml:
print '- region %-20s: avatars: %d' % (region.attrib['name'], int(region.attrib['avatars']))
print ' %-20s objects: %d' % (' ', int(region.attrib['objects']))
totalAvatars += int(region.attrib['avatars'])
totalObjects += int(region.attrib['objects'])
print 'total avatars: %d' % totalAvatars
print 'total objects: %d\n' % totalObjects
if __name__ == '__main__':
for opensim in sys.argv[1:]:
RegionInfo(opensim)
[/python]
invoke it like this:
% osinfo http://opensim.zurich.ibm.com:9000
and you will get output similar to this:
== OpenSim server http://opensim.zurich.ibm.com:9000/ ==
regions (curr): 6
regions (max): 10
- region ST3D theatre : avatars: 0
objects: 494
- region ST3D collaboration : avatars: 0
objects: 283
- region ST3D boardroom : avatars: 0
objects: 243
- region Zurich ISL : avatars: 0
objects: 0
- region IBM ACVWS 2009 : avatars: 0
objects: 283
- region Sametime 3D : avatars: 0
objects: 16
total avatars: 0
total objects: 1319
quite useful.
