2012-08-07 07:16:31 +02:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
|
|
|
from sys import argv
|
|
|
|
import httplib
|
|
|
|
conns = []
|
|
|
|
|
|
|
|
# this should really go in plugins.conf
|
|
|
|
conns.append(httplib.HTTPConnection("localhost",8080))
|
|
|
|
conns.append(httplib.HTTPConnection("localhost",8070))
|
|
|
|
|
|
|
|
|
|
|
|
url = "/munin_cache_parameters.py"
|
|
|
|
|
|
|
|
if len(argv) > 1 and argv[1] == 'config':
|
|
|
|
|
|
|
|
# there is probably a better way to display this cached vs targed graph
|
|
|
|
# as a percentage of target possibly..
|
|
|
|
|
|
|
|
print """graph_title Zope cache parameters
|
2017-02-22 20:13:18 +01:00
|
|
|
graph_category appserver
|
2012-08-07 07:16:31 +02:00
|
|
|
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")
|
|
|
|
for i in range(0,len(conns)):
|
|
|
|
print """obs_in_db%(i)s.label Z%(i)s Obs in DB
|
|
|
|
obs_cached%(i)s.label Z%(i)s obs in all caches
|
|
|
|
obs_target%(i)s.label Z%(i)s cached obs target""".replace("\n ","\n") % dict(i=i)
|
|
|
|
else:
|
|
|
|
for i in range(0,len(conns)):
|
|
|
|
conns[i].request("GET", url)
|
|
|
|
|
|
|
|
r1 = conns[i].getresponse()
|
|
|
|
#print r1.status, r1.reason
|
|
|
|
#200 OK
|
|
|
|
data = r1.read().strip()
|
|
|
|
conns[i].close()
|
|
|
|
(obs_in_db, obs_cached, obs_target) = data.split()
|
|
|
|
id = dict(i=i)
|
|
|
|
print 'obs_in_db%(i)s.value' % id, obs_in_db
|
|
|
|
print 'obs_cached%(i)s.value'% id, obs_cached
|
|
|
|
print 'obs_target%(i)s.value'% id, obs_target
|
2018-08-02 02:03:42 +02:00
|
|
|
|
2012-08-07 07:16:31 +02:00
|
|
|
|
|
|
|
|
|
|
|
|