Module: check_mk
Branch: master
Commit: adf3303bfdc282c9ba06c5dde7c65c2524a0f9cc
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=adf3303bfdc282…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Dec 12 12:48:47 2012 +0100
apache_status: Fixed handling of PIDs with more than 4 numbers
---
ChangeLog | 1 +
agents/plugins/apache_status | 8 +++++++-
2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 276a139..43c16e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,7 @@
* Linux Agent, mk_postgres: Fixed database stats query to be compatible
with more versions of postgres
* apache_status: Modified to be usable on python < 2.6 (eg RHEL 5.x)
+ * apache_status: Fixed handling of PIDs with more than 4 numbers
* FIX: postgres_sessions: handle case of no active/no idle sessions
* FIX: correct backslash representation of windows logwatch files
* Add: New Check for Rittal CMC PSM-M devices
diff --git a/agents/plugins/apache_status b/agents/plugins/apache_status
index fae8a7c..beb1b56 100755
--- a/agents/plugins/apache_status
+++ b/agents/plugins/apache_status
@@ -40,8 +40,14 @@ def try_detect_servers():
pid, proc = parts[6].split('/')
+ procs = [ 'apache2', 'httpd', 'httpd2-prefork',
'httpd2-worker', 'httpd.worker' ]
+ # the pid/proc field length is limited to 19 chars. Thus in case of
+ # long PIDs, the process names are stripped of by that length.
+ # Workaround this problem here
+ procs = [ p[:19 - len(pid) - 1] for p in procs ]
+
# Skip unwanted processes
- if proc not in [ 'apache2', 'httpd', 'httpd2-prefork',
'httpd2-worker', 'httpd.worker' ]:
+ if proc not in procs:
continue
# Add only the first found port of a single server process