From 2c99f32750eb47ec4c8838df4ad57d84a5265531 Mon Sep 17 00:00:00 2001 From: iborodikhin Date: Mon, 10 Sep 2012 12:08:04 +0600 Subject: [PATCH 1/4] Adding critical environment variable use --- plugins/sphinx/sphindex_ | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/sphinx/sphindex_ b/plugins/sphinx/sphindex_ index 025a6762..e492b16c 100755 --- a/plugins/sphinx/sphindex_ +++ b/plugins/sphinx/sphindex_ @@ -40,15 +40,20 @@ indexName = progName[progName.find("_")+1:] if len(sys.argv) == 2 and sys.argv[1] == "autoconf": print "yes" elif len(sys.argv) == 2 and sys.argv[1] == "config": - print "graph_title Sphinx index %s stats"%indexName + critical = "0:" + if "critical" in os.environ and os.environ["critical"] != None: + warning = os.environ["critical"] + + print "graph_title Sphinx index %s stats" % indexName print "graph_vlabel docs count" print "graph_category search" + print "load.critical %s" % critical print "documents_count.label Documents count in index" print "graph_args --base 1000 -l 0" else: if "server" in os.environ and os.environ["server"] != None: - server = os.environ["server"] + server = os.environ["server"] else: server = "localhost" @@ -66,4 +71,4 @@ else: result = client.Query("", indexName) docCount = result["total_found"] - print "documents_count.value %d"%docCount + print "documents_count.value %d" % docCount From b3beac1cd77d4c5dbdda805f1d71b9891568c26f Mon Sep 17 00:00:00 2001 From: iborodikhin Date: Mon, 10 Sep 2012 12:33:12 +0600 Subject: [PATCH 2/4] Adding critical environment variable use --- plugins/sphinx/sphindex_ | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/sphinx/sphindex_ b/plugins/sphinx/sphindex_ index e492b16c..54ab773c 100755 --- a/plugins/sphinx/sphindex_ +++ b/plugins/sphinx/sphindex_ @@ -47,8 +47,7 @@ elif len(sys.argv) == 2 and sys.argv[1] == "config": print "graph_title Sphinx index %s stats" % indexName print "graph_vlabel docs count" print "graph_category search" - print "load.critical %s" % critical - + print "documents_count.critical %s" % critical print "documents_count.label Documents count in index" print "graph_args --base 1000 -l 0" else: From 61de47ebd281cbe20e0e626af83e88088d6576af Mon Sep 17 00:00:00 2001 From: iborodikhin Date: Mon, 10 Sep 2012 12:36:15 +0600 Subject: [PATCH 3/4] Adding 'warning' environment variable use --- plugins/sphinx/sphindex_ | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/sphinx/sphindex_ b/plugins/sphinx/sphindex_ index 54ab773c..a924f561 100755 --- a/plugins/sphinx/sphindex_ +++ b/plugins/sphinx/sphindex_ @@ -40,9 +40,12 @@ indexName = progName[progName.find("_")+1:] if len(sys.argv) == 2 and sys.argv[1] == "autoconf": print "yes" elif len(sys.argv) == 2 and sys.argv[1] == "config": + warning = "0:" critical = "0:" + if "warning" in os.environ and os.environ["warning"] != None: + warning = os.environ["warning"] if "critical" in os.environ and os.environ["critical"] != None: - warning = os.environ["critical"] + critical = os.environ["critical"] print "graph_title Sphinx index %s stats" % indexName print "graph_vlabel docs count" From c5e74d82f579b088936d60d9bcace914ceab3d40 Mon Sep 17 00:00:00 2001 From: iborodikhin Date: Mon, 10 Sep 2012 12:39:04 +0600 Subject: [PATCH 4/4] Bug fix --- plugins/sphinx/sphindex_ | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/sphinx/sphindex_ b/plugins/sphinx/sphindex_ index a924f561..5cb775dd 100755 --- a/plugins/sphinx/sphindex_ +++ b/plugins/sphinx/sphindex_ @@ -50,6 +50,7 @@ elif len(sys.argv) == 2 and sys.argv[1] == "config": print "graph_title Sphinx index %s stats" % indexName print "graph_vlabel docs count" print "graph_category search" + print "documents_count.warning %s" % warning print "documents_count.critical %s" % critical print "documents_count.label Documents count in index" print "graph_args --base 1000 -l 0"