Module: check_mk
Branch: master
Commit: c48ed5d124bc0d068173cec2a116803948489069
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c48ed5d124bc0d…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Mon Sep 2 11:44:10 2013 +0200
fixing bug #0971: agent plugin apache_status now also works, if prog name contains
slashes
---
ChangeLog | 1 +
agents/plugins/apache_status | 6 ++++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 40bb853..a63d4c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -73,6 +73,7 @@
* df: Negative integer levels for MB left on a device
* win_printers: Monitoring of printer queue on a windows printserver
* FIX: hr_mem: handle virtual memory correct on some devices
+ * FIX: apache_status agent plugin: now also works, if prog name contains slashes
Notifications:
* notify.py: Matching service level: Use the hosts service level if a
diff --git a/agents/plugins/apache_status b/agents/plugins/apache_status
index df2ee7f..79d9de3 100755
--- a/agents/plugins/apache_status
+++ b/agents/plugins/apache_status
@@ -18,7 +18,7 @@
# 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
+import os, sys, urllib2, re
config_dir = os.getenv("MK_CONFDIR", "/etc/check_mk")
config_file = config_dir + "/apache_status.conf"
@@ -43,7 +43,9 @@ def try_detect_servers():
if len(parts) < 7 or '/' not in parts[6]:
continue
- pid, proc = parts[6].split('/')
+ pid, proc = parts[6].split('/', 1)
+ to_replace = re.compile('^.*/')
+ proc = to_replace.sub('', proc)
procs = [ 'apache2', 'httpd', 'httpd2-prefork',
'httpd2-worker', 'httpd.worker' ]
# the pid/proc field length is limited to 19 chars. Thus in case of