summaryrefslogtreecommitdiffstats
path: root/src/sbin/SummarizeStats
blob: 5f2d77cba986483efb26a049cbfeb807368efcb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/env python
from ConfigParser import ConfigParser
from elementtree.ElementTree import XML

if __name__ == '__main__':
    c = ConfigParser()
    c.read(['/etc/bcfg2.conf'])
    statpath = "%s/statistics.xml" % c.get('server', 'metadata')
    statdata = XML(open(statpath).read())
    for child in statdata.findall("Node"):
        print "Node: %s:" % child.get("name")
        for state in child.findall("Statistics"):
            print "\tState: %s %s" % (state.get("state"), state.get("time"))