Module: check_mk
Branch: master
Commit: 1afe93712edd8a4dd1b8bc0c945a11e028cd0d7e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1afe93712edd8a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Jun 1 10:46:18 2015 +0200
Cleaned up new omd_apache check
---
agents/check_mk_agent.linux | 11 +++++++++++
checks/omd_apache | 10 ++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux
index aa53d27..af18cbe 100755
--- a/agents/check_mk_agent.linux
+++ b/agents/check_mk_agent.linux
@@ -531,6 +531,17 @@ then
grep -v '^#' < $statefile
fi
done
+
+ echo '<<<omd_apache:sep(124)>>>'
+ for statsfile in /omd/sites/*/var/log/apache/stats; do
+ if [ -e "$statsfile" ] ; then
+ site=${statsfile%/var/log*}
+ site=${site#/omd/sites/}
+ echo "[$site]"
+ cat $statsfile
+ > $statsfile
+ fi
+ done
fi
# Status of Check_MK Notification Spooler
diff --git a/checks/omd_apache b/checks/omd_apache
index b90263e..15505fe 100644
--- a/checks/omd_apache
+++ b/checks/omd_apache
@@ -49,16 +49,22 @@ def inventory_omd_apache(info):
yield line[0][1:-1], None
def check_omd_apache(item, _no_params, info):
+ # First initialize all possible values to be able to always report all perf keys
+ stats = {'requests': {}, 'secs': {}, 'bytes': {}}
+ for key, pattern in omd_apache_patterns:
+ stats['requests'][key] = 0
+ stats['secs'][key] = 0
+ stats['bytes'][key] = 0
+
active = False
found = False
- stats = {'requests': {}, 'secs': {}, 'bytes': {}}
for line in info:
if line[0] == '[' + item + ']':
active = True
elif active and line[0] == '[':
break
elif active:
- method, url, status, size_bytes, microsec = line
+ url, status, size_bytes, microsec = line
for key, pattern in omd_apache_patterns:
# make url relative to site directory
if regex(pattern).search(url[len('/'+item+'/'):]):