root / plugins / zope / zope_cache_parameters @ a7139bca
Historique | Voir | Annoter | Télécharger (1,32 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_cache_parameters.py" |
||
| 13 | |||
| 14 | if len(argv) > 1 and argv[1] == 'config': |
||
| 15 | |||
| 16 | 8713eb37 | Lars Kruse | # there is probably a better way to display this cached vs target graph |
| 17 | 038c3ce9 | Diego Elio Pettenò | # as a percentage of target possibly.. |
| 18 | |||
| 19 | print """graph_title Zope cache parameters |
||
| 20 | 68bb709d | dipohl | graph_category appserver |
| 21 | 038c3ce9 | Diego Elio Pettenò | graph_info A grap of the main data on the "Cache Parameters" tab of the main DB in the zope control panel.""".replace("\n ","\n")
|
| 22 | for i in range(0,len(conns)): |
||
| 23 | print """obs_in_db%(i)s.label Z%(i)s Obs in DB |
||
| 24 | obs_cached%(i)s.label Z%(i)s obs in all caches |
||
| 25 | obs_target%(i)s.label Z%(i)s cached obs target""".replace("\n ","\n") % dict(i=i)
|
||
| 26 | else: |
||
| 27 | for i in range(0,len(conns)): |
||
| 28 | conns[i].request("GET", url)
|
||
| 29 | |||
| 30 | r1 = conns[i].getresponse() |
||
| 31 | #print r1.status, r1.reason |
||
| 32 | #200 OK |
||
| 33 | data = r1.read().strip() |
||
| 34 | conns[i].close() |
||
| 35 | (obs_in_db, obs_cached, obs_target) = data.split() |
||
| 36 | id = dict(i=i) |
||
| 37 | print 'obs_in_db%(i)s.value' % id, obs_in_db |
||
| 38 | print 'obs_cached%(i)s.value'% id, obs_cached |
||
| 39 | print 'obs_target%(i)s.value'% id, obs_target |
||
| 40 | 17f78427 | Lars Kruse | |
| 41 | 038c3ce9 | Diego Elio Pettenò | |
| 42 |
