Module: check_mk
Branch: master
Commit: 3b386fabe19908591dbac6362b5e5ba1fb22e92b
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3b386fabe19908…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Dec 12 14:02:53 2012 +0100
mysql_connections: Handling missing data correctly
---
checks/mysql | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/checks/mysql b/checks/mysql
index 4fe957b..025a0c4 100644
--- a/checks/mysql
+++ b/checks/mysql
@@ -171,6 +171,9 @@ def inventory_mysql_connections(info):
def check_mysql_connections(item, params, info):
values = parse_mysql(info)
+ if 'Max_used_connections' not in values:
+ return (3 'UNKNOWN - Connection information are missing')
+
# The maximum number of connections that have been in use simultaneously
# since the server started.
conn = float(values['Max_used_connections'])
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
Module: check_mk
Branch: master
Commit: 394aa76d09b16a8da2aef392193b6bc5619c8f71
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=394aa76d09b16a…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Dec 11 22:26:12 2012 +0100
FIX: apache_status: fixed bug with missing url, wrote man page
---
ChangeLog | 1 +
agents/apache_status.cfg | 11 +++++++++++
agents/plugins/apache_status | 1 +
checkman/apache_status | 36 ++++++++++++++++++++++++++++++++++++
checks/apache_status | 2 +-
5 files changed, 50 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e76326d..a87d677 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -28,6 +28,7 @@
* Add: plesk_backups - Monitor backup spaces configured for domains in plesk
* FIX: zfsget: fix exception on snapshot volumes (where available is '-')
* FIX: oracle_version: return valid check result in case of missing agent info
+ * FIX: apache_status: fixed bug with missing 'url', wrote man page
Multisite:
* Implemented LDAP integration of Multisite. You can now authenticate your
diff --git a/agents/apache_status.cfg b/agents/apache_status.cfg
new file mode 100644
index 0000000..cd871d9
--- /dev/null
+++ b/agents/apache_status.cfg
@@ -0,0 +1,11 @@
+# Example for configuration for apache_status plugin
+# Note: you need this file only if the autodetection fails
+# or you do not want to contact all servers it detects
+
+# Note: Activate this only if the autodetection fails.
+# servers = [
+# ('http', 'localhost', 80),
+# ('https', 'localhost', 443),
+# ('http', 'localhost', 8080),
+# ]
+
diff --git a/agents/plugins/apache_status b/agents/plugins/apache_status
index fae8a7c..295012b 100755
--- a/agents/plugins/apache_status
+++ b/agents/plugins/apache_status
@@ -77,6 +77,7 @@ if not servers:
print '<<<apache_status>>>'
for proto, address, port in servers:
try:
+ url = '%s://%s:%s/server-status?auto' % (proto, address, port)
# Try to fetch the status page for each server
try:
fd = urllib2.urlopen(url)
diff --git a/checkman/apache_status b/checkman/apache_status
new file mode 100644
index 0000000..9f0e772
--- /dev/null
+++ b/checkman/apache_status
@@ -0,0 +1,36 @@
+title: Check performance indicators of Apache web server
+agents: linux
+author: Lars Michelsen <lm(a)mathias-kettner.de>
+license: GPL
+distribution: check_mk
+description:
+ This check parses the information provided by the Apache status module.
+ If you have enabled that module (on Debian/Ubuntu this is the default),
+ then below the URL {/server-status} Apache show interesting information
+ about the number of connections and the like. The agent plugin {apache_status}
+ fetches that data and this check processes it. The status is always OK,
+ but it fetches interesting performance data.
+
+ As a preparation you need to install the agent plugin {apache_status}
+ into you agent's plugins directory (usually {/usr/lib/check_mk_agent/plugins}).
+ The plugin tries to autodetect all running apache servers. If that fails
+ for some reason you need to create the configuration file
+ {/etc/check_mk/apache_status.cfg} and list your servers here. Write
+ a Python list of triples of protocol, servername and port. Here is
+ an example: {servers = [('http', 'localhost', 80),('https', 'localhost', 443)]}.
+
+inventory:
+ One service per Apache server will be created.
+
+item:
+ A string-combination of servername and port, e.g. {127.0.0.1:5000}.
+
+perfdata:
+ This check outputs lots of performance variables since this is the
+ purpose of the check. Please look at the shipped PNP template for
+ details.
+
+
+
+
+
diff --git a/checks/apache_status b/checks/apache_status
index 5dd32db..af70ca9 100644
--- a/checks/apache_status
+++ b/checks/apache_status
@@ -88,7 +88,7 @@ def inventory_apache_status(info):
inv.append((item, None))
return inv
-def check_apache_status(item, params, info):
+def check_apache_status(item, _no_params, info):
all_data = apache_status_parse(info)
if item not in all_data:
return (3, 'UNKNOWN - Unable to find instance in agent output')