[Checkins] SVN: Products.ZNagios/trunk/ merging in changes made in branches/frisi-multizeo
Harald Friessnegger
harald at webmeisterei.com
Thu Nov 19 09:47:58 EST 2009
Log message for revision 105876:
merging in changes made in branches/frisi-multizeo
Changed:
U Products.ZNagios/trunk/CHANGES.txt
U Products.ZNagios/trunk/Products/ZNagios/munin_client.py
U Products.ZNagios/trunk/Products/ZNagios/zeo_munin.py
U Products.ZNagios/trunk/README.txt
U Products.ZNagios/trunk/setup.py
-=-
Modified: Products.ZNagios/trunk/CHANGES.txt
===================================================================
--- Products.ZNagios/trunk/CHANGES.txt 2009-11-19 14:33:44 UTC (rev 105875)
+++ Products.ZNagios/trunk/CHANGES.txt 2009-11-19 14:47:58 UTC (rev 105876)
@@ -4,7 +4,24 @@
0.4 - unreleased
----------------
+- uptime is given in days now, instead of seconds which is much more readable.
+ `fetch` still returns seconds for backward compatibility,
+ but `config` tells to compute the value (``uptime.cdef uptime,86400,/``)
+ [fRiSi]
+- `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/trunk/Products/ZNagios/munin_client.py
===================================================================
--- Products.ZNagios/trunk/Products/ZNagios/munin_client.py 2009-11-19 14:33:44 UTC (rev 105875)
+++ Products.ZNagios/trunk/Products/ZNagios/munin_client.py 2009-11-19 14:47:58 UTC (rev 105876)
@@ -53,16 +53,21 @@
title = ''
name = ''
key = ''
+ vlabel = '' #label for y-axis, use name if vlabel is not specified
+ cdef = '' #rpn-expression used to compute the value (eg `%s,86400,/') to devide the value by 86400
+
def do_fetch(self):
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_vlabel %s" % (self.name)
+ print "graph_vlabel %s" % (self.vlabel or self.name)
print "graph_category Zope"
print "graph_info %s of Zope %s " % (self.title, server_index)
print "%s.label %s" % (self.name, self.name)
+ if self.cdef:
+ print "%s.cdef " % self.name + self.cdef % self.name
class SimpleMultiGraph(GraphBase):
@@ -86,9 +91,13 @@
class uptime(SimpleGraph):
+ """uptime in days"""
+
key = name = 'uptime'
title = 'Uptime'
+ vlabel = 'days'
+ cdef = '%s,86400,/'
class refcount(SimpleGraph):
@@ -117,10 +126,22 @@
name = 'cache_size'
title = 'Total cache size'
+class dbsize(SimpleGraph):
+ """Database Size in MB.
+ """
+
+ key = 'db-bytes'
+ name = 'database_size'
+ title = 'Size of main Database'
+ vlabel = 'MB'
+ cdef = '%s,1048576,/'
+
+
+
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 +163,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/trunk/Products/ZNagios/zeo_munin.py
===================================================================
--- Products.ZNagios/trunk/Products/ZNagios/zeo_munin.py 2009-11-19 14:33:44 UTC (rev 105875)
+++ Products.ZNagios/trunk/Products/ZNagios/zeo_munin.py 2009-11-19 14:47:58 UTC (rev 105876)
@@ -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/trunk/README.txt
===================================================================
--- Products.ZNagios/trunk/README.txt 2009-11-19 14:33:44 UTC (rev 105875)
+++ Products.ZNagios/trunk/README.txt 2009-11-19 14:47:58 UTC (rev 105876)
@@ -15,8 +15,46 @@
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 days (1 hour is 0.041)
+
+refcount
+ XXX help document
+
+errors
+ total number of errors, conflicts and unresolved conflicts
+
+activity
+ total number of object loads, stores and
+ total number of database connections
+
+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 +84,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 +155,4 @@
- Martijn Pieters (Pareto)
- Florian Schulze (independent)
- Hanno Schlichting (Jarn)
+- Harald Friessnegger (Webmeisterei)
Modified: Products.ZNagios/trunk/setup.py
===================================================================
--- Products.ZNagios/trunk/setup.py 2009-11-19 14:33:44 UTC (rev 105875)
+++ Products.ZNagios/trunk/setup.py 2009-11-19 14:47:58 UTC (rev 105876)
@@ -1,6 +1,6 @@
from setuptools import setup, find_packages
-version = '0.4dev'
+version = '0.4'
setup(name='Products.ZNagios',
version=version,
@@ -13,6 +13,7 @@
"Framework :: Zope2",
"License :: OSI Approved :: Zope Public License",
"Programming Language :: Python",
+ "Topic :: System :: Monitoring",
],
keywords='Zope Nagios Munin',
author="Zope Corporation and contributors",
More information about the checkins
mailing list