[Checkins] SVN: Products.ZNagios/branches/frisi-multizeo/ support mutliple dbs, added documentation, corrected labels, added dbsize graph
Harald Friessnegger
harald at webmeisterei.com
Mon Nov 16 15:47:56 EST 2009
Log message for revision 105730:
support mutliple dbs, added documentation, corrected labels, added dbsize graph
Changed:
U Products.ZNagios/branches/frisi-multizeo/CHANGES.txt
U Products.ZNagios/branches/frisi-multizeo/Products/ZNagios/munin_client.py
U Products.ZNagios/branches/frisi-multizeo/Products/ZNagios/zeo_munin.py
U Products.ZNagios/branches/frisi-multizeo/README.txt
-=-
Modified: Products.ZNagios/branches/frisi-multizeo/CHANGES.txt
===================================================================
--- Products.ZNagios/branches/frisi-multizeo/CHANGES.txt 2009-11-16 16:53:18 UTC (rev 105729)
+++ Products.ZNagios/branches/frisi-multizeo/CHANGES.txt 2009-11-16 20:47:56 UTC (rev 105730)
@@ -4,7 +4,19 @@
0.4 - unreleased
----------------
+- `zeo_munin.py` can handle multiple Databases now
+ [fRiSi]
+- Documented munin data and configuration in README
+ [fRiSi]
+
+- Corrected labels in `Per connection caches` graph
+ [fRiSi]
+
+- Added `dbsize` graph to `munin_client.py`
+ [fRiSi]
+
+
0.3 - 2009-02-25
----------------
Modified: Products.ZNagios/branches/frisi-multizeo/Products/ZNagios/munin_client.py
===================================================================
--- Products.ZNagios/branches/frisi-multizeo/Products/ZNagios/munin_client.py 2009-11-16 16:53:18 UTC (rev 105729)
+++ Products.ZNagios/branches/frisi-multizeo/Products/ZNagios/munin_client.py 2009-11-16 20:47:56 UTC (rev 105730)
@@ -117,10 +117,22 @@
name = 'cache_size'
title = 'Total cache size'
+class dbsize(SimpleGraph):
+ """Database Size in MB.
+ """
+
+ def do_fetch(self):
+ print "%s.value %.2f" % (self.name, self.data[self.key]/1048576)
+
+ key = 'db-bytes'
+ name = 'database_size'
+ title = 'Size of main Database'
+
+
class cacheconnections(GraphBase):
def do_fetch(self):
- i = 0
+ i = 0
while True:
active = self.data.get('db-cache-conn%s-active-objects' % i)
if active is None:
@@ -142,8 +154,8 @@
print "active3.label Connection 4: Active objects"
print "total0.label Connection 1: Total objects"
print "total1.label Connection 2: Total objects"
- print "total2.label Connection 2: Total objects"
- print "total3.label Connection 3: Total objects"
+ print "total2.label Connection 3: Total objects"
+ print "total3.label Connection 4: Total objects"
graph = locals()[graph]()
getattr(graph, cmd)()
Modified: Products.ZNagios/branches/frisi-multizeo/Products/ZNagios/zeo_munin.py
===================================================================
--- Products.ZNagios/branches/frisi-multizeo/Products/ZNagios/zeo_munin.py 2009-11-16 16:53:18 UTC (rev 105729)
+++ Products.ZNagios/branches/frisi-multizeo/Products/ZNagios/zeo_munin.py 2009-11-16 20:47:56 UTC (rev 105730)
@@ -24,7 +24,12 @@
cmd = 'fetch'
script_name = os.path.basename(sys.argv[0])
-_, graph, server_index = script_name.split('_')
+try:
+ _, graph, server_index, storage = script_name.split('_')
+except ValueError:
+ #bbb default storage 1
+ _, graph, server_index = script_name.split('_')
+ storage = '1'
HOST = os.environ['MUNIN_ZEO_HOST_%s' % server_index]
PORT = os.environ['MUNIN_ZEO_PORT_%s' % server_index]
@@ -35,25 +40,34 @@
def _prepare_fetch(self):
tn = telnetlib.Telnet(HOST, PORT)
result = tn.read_all()
- result = tn.splitlines()
+ result = result.splitlines()
self.data = {}
# First line is a server signature
- line = result.pop()
+ line = result.pop(0)
assert line.startswith('ZEO monitor server version 3.')
# Second line is a date
- line = result.pop()
+ line = result.pop(0)
# Third line is empty
- line = result.pop()
+ line = result.pop(0)
assert line == ''
- # Fourth line is storage-signature
- line = result.pop()
- assert line == 'Storage: 1'
+ # now different storage signatures follow
+ # skip all of them until we reach the one we're interested in
+ while result and line != 'Storage: %s' % storage:
+ line = result.pop(0)
+
+ if not result:
+ #the storage has not been found
+ return
+
for line in result:
if line.startswith('Server started'):
continue
if line == '':
continue
+ if line.startswith('Storage:'):
+ #skip other storages
+ break
key, value = line.split(':')
self.data[key.lower()] = float(value)
@@ -72,7 +86,7 @@
print "%s.value %s" % (self.name, self.data[self.key])
def config(self):
- print "graph_title %s (Zope %s)" % (self.title, server_index)
+ print "graph_title %s (Zope %s %s)" % (self.title, server_index, storage)
print "graph_vlabel %s" % (self.name)
print "graph_category Zope"
print "graph_info %s of Zope %s " % (self.title, server_index)
@@ -112,6 +126,15 @@
name = 'verifying'
title = 'Clients verifying'
+class loadstores(SimpleMultiGraph):
+ title = 'Loads Stores'
+ vlabel = 'num objects'
+ keys = ['loads',
+ 'stores']
+ names = ['object_loads',
+ 'object_stores']
+
+
graph = locals()[graph]()
getattr(graph, cmd)()
Modified: Products.ZNagios/branches/frisi-multizeo/README.txt
===================================================================
--- Products.ZNagios/branches/frisi-multizeo/README.txt 2009-11-16 16:53:18 UTC (rev 105729)
+++ Products.ZNagios/branches/frisi-multizeo/README.txt 2009-11-16 20:47:56 UTC (rev 105730)
@@ -15,8 +15,53 @@
Munin data
----------
-XXX
+graphs provided by zeo_munin.py
+```````````````````````````````
+clients
+ nr of zeo clients connected to zeo server
+
+verifying
+ XXX help document
+
+loadstores
+ nr of object loads and stores of the database
+
+
+graphs provided by munin_client.py
+``````````````````````````````````
+
+uptime
+ uptime of the zope instance in seconds
+
+ XXX shouldn't we change this to days? (much more readable, `varnish_ plugin`_ does this too)
+
+ .. _`varnish_ plugin`: http://varnish.projects.linpro.no/browser/trunk/varnish-tools/munin/varnish_
+
+refcount
+ XXX help document
+
+errors
+ total number of errors, conflicts and unresolved conflicts
+ that occured since last startup
+
+activity
+ nr of object loads, stores and
+ number of database connections
+
+ XXX connections is 0 for me all the time?
+
+cacheconnections
+ number of active and total objects for each connection
+
+cachetotals
+ number of active objects of all connections
+ (see cacheconnections above)
+
+dbsize
+ size of the database in megabyte
+
+
Configure Nagios
----------------
@@ -46,6 +91,66 @@
check_command check_zope!thezopehost!8080!1000000000!500000!admin:password
}
+Configure Munin
+---------------
+
+Symlink Plugins
+```````````````
+
+Create symlinks in ``/etc/munin/plugins/``
+
+plugins using munin_client.py are named like::
+
+ /etc/munin/plugins/zope_<graph>_<server-index>
+
+ eg:
+ /etc/munin/plugins/zope_uptime_instance1
+ /etc/munin/plugins/zope_uptime_instance2
+
+plugins using zeo_munin.py are named like::
+
+ /etc/munin/plugins/zeo_<graph>_<server-index>[_<storage>]
+
+graph
+ see `Munin data`_ for a list of available graphs
+
+server-index
+ host and port are looked up in the configuration
+ MUNIN_ZEO_HOST|PORT_<server-index>
+
+storage
+ name of the storage, optional, defaults to 1
+
+
+examples::
+
+ /etc/munin/plugins/zeo_clients_ZEO1
+ /etc/munin/plugins/zeo_clients_ZEO1_1
+ /etc/munin/plugins/zeo_loadstores_ZEO1_temp
+
+
+
+Configure Plugins
+`````````````````
+
+Add a configuration file to ``vim /etc/munin/plugin-conf.d/zope``
+to tell the plugins how to connect to zeo server/clients::
+
+ [zope_*]
+ user root
+ env.MUNIN_ZOPE_HOST_instance1 http://localhost:8401/Control_Panel/munin
+ env.MUNIN_ZOPE_AUTHENTICATE_instance1 admin:admin
+ env.MUNIN_ZOPE_HOST_instance2 http://localhost:8402/Control_Panel/munin
+ env.MUNIN_ZOPE_AUTHENTICATE_instance2 admin:admin
+
+ [zeo_*]
+ user root
+ env.MUNIN_ZEO_HOST_ZEO1 localhost
+ env.MUNIN_ZEO_PORT_ZEO1 8502
+
+
+
+
Credits
-------
@@ -57,3 +162,4 @@
- Martijn Pieters (Pareto)
- Florian Schulze (independent)
- Hanno Schlichting (Jarn)
+- Harald Friessnegger (Webmeisterei)
More information about the checkins
mailing list