From bacc2e195de6e6755b3c043ba6a8c7fe1f25d409 Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Fri, 7 Dec 2007 09:26:35 +0000
Subject: [PATCH] Add activity validation/execution monitoring scripts.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18111 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/CMFActivity/bin/watch_activities   | 9 +++++++++
 product/CMFActivity/bin/watch_distribution | 9 +++++++++
 2 files changed, 18 insertions(+)
 create mode 100755 product/CMFActivity/bin/watch_activities
 create mode 100755 product/CMFActivity/bin/watch_distribution

diff --git a/product/CMFActivity/bin/watch_activities b/product/CMFActivity/bin/watch_activities
new file mode 100755
index 0000000000..7851f8ba5a
--- /dev/null
+++ b/product/CMFActivity/bin/watch_activities
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+if [ $# -ne 1 ]; then
+  echo "Usage:\n  $0 <db_name>"
+  exit 1
+fi
+
+watch -n 5 "mysql -h localhost -u root -t '$1' --disable-pager -t -e 'SELECT count(path) as MESSAGE, method_id, processing as run, processing_node as node FROM message WHERE processing_node > -1 GROUP BY  method_id, processing, processing_node; SELECT count(path) as MESSAGE_QUEUE, method_id, processing as run, processing_node as node FROM message_queue WHERE processing_node > -1 GROUP BY method_id, processing, processing_node' "
+
diff --git a/product/CMFActivity/bin/watch_distribution b/product/CMFActivity/bin/watch_distribution
new file mode 100755
index 0000000000..77d07ef11c
--- /dev/null
+++ b/product/CMFActivity/bin/watch_distribution
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+if [ $# -ne 2 ]; then
+	echo -e "Usage:\n  $0 db_name table_name"
+  exit 1
+fi
+
+watch -n 1 "mysql -u root -t '$1' --disable-pager -t -e '  SELECT count(*) as NEW FROM \`$2\` WHERE processing_node = -1; SELECT count(*) as VALID FROM \`$2\` WHERE processing_node = 0; SELECT count(*) as ASSIGNED FROM \`$2\` WHERE processing_node > 0; SELECT count(*) as PROCESSING FROM \`$2\` WHERE processing = 1; SELECT count(*) as ASSIGNED, processing_node as node FROM \`$2\` WHERE processing_node > 0 GROUP BY processing_node; SELECT count(*) as PROCESSING, processing_node as node FROM \`$2\` WHERE processing_node > 0 AND processing = 1 GROUP BY processing_node; SELECT count(*) as FAILURE FROM \`$2\` WHERE processing_node = -2; SELECT count(*) as ERROR FROM \`$2\` WHERE processing_node = -3;'"
+
-- 
2.30.9