May 11, 2009
filed just before lunchtime by DrScofield in: from the grid,hacking
technorati tags:
QR code for this entry · average time to read 0:56 minutes

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:

#!/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)

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.

all content posted on these pages is an expression of my own mind. my employer is welcome to share these opinions but then again he might not want to.

no Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment