root / plugins / zope / zope_db_activity @ a7139bca
Historique | Voir | Annoter | Télécharger (1,34 ko)
| 1 | a7139bca | Lars Kruse | #!/usr/bin/env python |
|---|---|---|---|
| 2 | 038c3ce9 | Diego Elio Pettenò | |
| 3 | from sys import argv |
||
| 4 | import httplib |
||
| 5 | conns = [] |
||
| 6 | |||
| 7 | # this should really go in plugins.conf |
||
| 8 | conns.append(httplib.HTTPConnection("localhost",8080))
|
||
| 9 | conns.append(httplib.HTTPConnection("localhost",8070))
|
||
| 10 | |||
| 11 | |||
| 12 | url = "/munin_db_activity.py" |
||
| 13 | |||
| 14 | if len(argv) > 1 and argv[1] == 'config': |
||
| 15 | |||
| 16 | print """graph_title Zope Database Activity |
||
| 17 | graph_vlabel Count / 5 min. |
||
| 18 | 68bb709d | dipohl | graph_category appserver |
| 19 | 038c3ce9 | Diego Elio Pettenò | graph_info The number of Reads, Stores, and Connections that happens in the ZODB backend. The data comes from the same source as that in the "Recent Database Activity" tab in the zope control panel.""".replace("\n ","\n")
|
| 20 | for i in range(0,len(conns)): |
||
| 21 | print """load_count%(i)s.label Z%(i)s Loads |
||
| 22 | store_count%(i)s.label Z%(i)s Stores |
||
| 23 | connections%(i)s.label Z%(i)s Connections""".replace("\n ","\n") % dict(i=i)
|
||
| 24 | else: |
||
| 25 | for i in range(0,len(conns)): |
||
| 26 | conns[i].request("GET", url)
|
||
| 27 | |||
| 28 | r1 = conns[i].getresponse() |
||
| 29 | #print r1.status, r1.reason |
||
| 30 | #200 OK |
||
| 31 | data = r1.read().strip() |
||
| 32 | conns[i].close() |
||
| 33 | (total_load_count, total_store_count, total_connections) = data.split() |
||
| 34 | id = dict(i=i) |
||
| 35 | print 'load_count%(i)s.value' % id, total_load_count |
||
| 36 | print 'store_count%(i)s.value'% id, total_store_count |
||
| 37 | print 'connections%(i)s.value'% id, total_connections |
||
| 38 | 17f78427 | Lars Kruse | |
| 39 | 038c3ce9 | Diego Elio Pettenò | |
| 40 |
