Module: check_mk
Branch: master
Commit: 6111ffb8c69763aeaf966f7fadd0df3ccea207db
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6111ffb8c69763…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Dec 11 16:16:26 2012 +0100
apache_status agent plugin: working around problems with misconfigured apache servers
---
agents/plugins/apache_status | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/agents/plugins/apache_status b/agents/plugins/apache_status
index fd63734..fae8a7c 100755
--- a/agents/plugins/apache_status
+++ b/agents/plugins/apache_status
@@ -78,8 +78,17 @@ print '<<<apache_status>>>'
for proto, address, port in servers:
try:
# Try to fetch the status page for each server
- url = '%s://%s:%s/server-status?auto' % (proto, address, port)
- fd = urllib2.urlopen(url)
+ try:
+ fd = urllib2.urlopen(url)
+ except urllib2.URLError, e:
+ if 'SSL23_GET_SERVER_HELLO:unknown protocol' in str(e):
+ # HACK: workaround misconfigurations where port 443 is used for
+ # serving non ssl secured http
+ url = 'http://%s:%s/server-status?auto' % (address, port)
+ fd = urllib2.urlopen(url)
+ else:
+ raise
+
for line in fd.read().split('\n'):
if not line.strip():
continue