initial script for monitoring zope zeo servers
authorArthur Lutz <arthur.lutz@logilab.fr>
Wed, 25 Jun 2008 16:05:47 +0200
changeset 0 547747e0e0d9
child 1 a59236443410
initial script for monitoring zope zeo servers
zope_zeo_stats_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zope_zeo_stats_	Wed Jun 25 16:05:47 2008 +0200
@@ -0,0 +1,58 @@
+#! /bin/sh
+# arthur.lutz@logilab.fr   2008-06-25
+# graph the stats that we get from the monitor port of the zeo server
+
+#%# family=contrib
+#%# capabilities=autoconf suggest
+
+
+PATH="$PATH:/usr/local/bin"
+export PATH
+
+TYPE=`basename $0 | sed 's/^zope_zeo_stats_//g'`
+
+zeostat() {
+	#FIXME should store data in tmp file and then parse instead of connecting once per indicator
+	printf "$1.value "
+	telnet localhost 8101 2>&1 | sed 's/ //g' | egrep "$1:" | awk -F : '{print $2}'
+}
+
+case "$TYPE" in 
+	cnx)
+		INDICATORS="Storage Clients Clientsverifying Activetransactions Commits Aborts Conflicts Conflictsresolved" 
+		;;
+	db)
+		INDICATORS="Loads Stores"
+		;;
+esac
+
+case $1 in
+autoconf) 
+	echo yes
+	exit 0
+	;;
+suggest) 
+	echo db
+	echo cnx
+	exit 0
+	;;
+config)
+	echo "graph_title Zeo Server Stats ($TYPE)"
+	for i in $INDICATORS; do
+		echo "graph_vlabel $i";
+	done
+	echo 'graph_category zope'
+	echo 'graph_info This graph shows indicators for zeo clients from monitor server'
+
+	for i in $INDICATORS; do
+		echo "$i.label $i";
+		echo "$i.type DERIVE";
+		echo "$i.graph yes";
+	done
+	;;
+*)
+	for i in $INDICATORS; do
+		zeostat $i;
+	done
+	;;
+esac