Module: check_mk
Branch: master
Commit: 2fe4bbbce8cf1e26a2e43f9e187663d4abcc5ba5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2fe4bbbce8cf1e…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Mar 20 09:51:36 2015 +0100
#2152 FIX apache_status: Fixed plugin to work on CentOS/RedHat 5.x
The agent plugin was not compatible with Python 2.4. This has been fixed now.
---
.werks/2152 | 10 ++++++++++
ChangeLog | 3 ++-
agents/plugins/apache_status | 12 ++++++++----
3 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/.werks/2152 b/.werks/2152
new file mode 100644
index 0000000..a9899bd
--- /dev/null
+++ b/.werks/2152
@@ -0,0 +1,10 @@
+Title: apache_status: Fixed plugin to work on CentOS/RedHat 5.x
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1426841453
+
+The agent plugin was not compatible with Python 2.4. This has been fixed now.
diff --git a/ChangeLog b/ChangeLog
index 954860a..0b30266 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -131,8 +131,8 @@
* 1231 mssql_counters.file_sizes: It's now possible to set levels for Filesizes
* 2104 aix_if: new agent section and check...
NOTE: Please refer to the migration notes!
+ * 2061 DB2 monitoring: Additional checks for AIX (and presumably linux)...
* 2105 mbg_lantime_ng_refclock: new check for Meinberg LANTIME clocks supporting the
new MBG-LANTIME-NG MIB
- * 2061 DB2 monitoring: Additional checks for aix (and presumably linux)...
* 1457 FIX: logins: new check renamed from "users" check...
NOTE: Please refer to the migration notes!
* 1762 FIX: lnx_thermal: Now ignoring trip points with level 0...
@@ -268,6 +268,7 @@
* 2059 FIX: ucs_bladecenter_if: fixed exception when fibrechannel interfaces were not
configured...
* 1233 FIX: Fixed fileinfo check for solaris in case of missing files
* 1236 FIX: multipath: Now show correct error in case of removed multipaths instead
of check crash
+ * 2152 FIX: apache_status: Fixed plugin to work on CentOS/RedHat 5.x...
Multisite:
* 1758 Improved exception hander: Shows details without additional debug request,
added mailto link for error report...
diff --git a/agents/plugins/apache_status b/agents/plugins/apache_status
index de7b187..f06b05d 100755
--- a/agents/plugins/apache_status
+++ b/agents/plugins/apache_status
@@ -41,15 +41,19 @@
# It is also possible to override or extend the ssl_ports variable to make the
# check contact other ports than 443 with HTTPS requests.
-import os, sys, urllib2, re
+import os, sys, urllib2, re, socket
config_dir = os.getenv("MK_CONFDIR", "/etc/check_mk")
config_file = config_dir + "/apache_status.conf"
-timeout = 5
if not os.path.exists(config_file):
config_file = config_dir + "/apache_status.cfg"
+# We have to deal with socket timeouts. Python > 2.6
+# supports timeout parameter for the urllib2.urlopen method
+# but we are on a python 2.5 system here which seem to use the
+# default socket timeout. We are local here so set it to 1 second.
+socket.setdefaulttimeout(5.0)
# None or list of (proto, ipaddress, port) tuples.
# proto is 'http' or 'https'
@@ -129,13 +133,13 @@ for server in servers:
# Try to fetch the status page for each server
try:
request = urllib2.Request(url, headers={"Accept" :
"text/plain"})
- fd = urllib2.urlopen(request, timeout=timeout)
+ fd = urllib2.urlopen(request)
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, timeout=timeout)
+ fd = urllib2.urlopen(url)
else:
raise