Module: check_mk
Branch: master
Commit: c83df933d97830b67262513eb9516616240c9697
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c83df933d97830…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed May 15 15:20:58 2013 +0200
new check winperf_tcp_conn
---
ChangeLog | 2 +
checks/winperf_tcp_conn | 71 ++++++++++++++++++++++++++++++++++
web/plugins/wato/check_parameters.py | 24 +++++++++++-
3 files changed, 96 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index ef50023..0cb5c01 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -96,6 +96,8 @@
* winperf_processor: Now displays (and scales) to number of cpus in pnpgraph
* mk_postgres plugin: replace select * with list of explicit columns (fix for PG
9.1)
* lnx_if: show MAC address for interfaces (needs also agent update)
+ * winperf_tcp_conn: New check. Displays number of established tcpv4 connections in
windows
+ Uses WATO Rule "TCP connection stats (Windows)"
Notifications:
* notify.py: unique spoolfiles name no longer created with uuid
diff --git a/checks/winperf_tcp_conn b/checks/winperf_tcp_conn
new file mode 100644
index 0000000..7427666
--- /dev/null
+++ b/checks/winperf_tcp_conn
@@ -0,0 +1,71 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2013 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at
http://mathias-kettner.de/check_mk.
+#
+# check_mk is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# ails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+
+# Example output from agent:
+# <<<winperf_tcp_conn>>>
+# 1368619819.06 638
+# 2 53267 counter
+# 4 3 rawcount
+# 6 23 rawcount
+# 8 1 rawcount
+# 10 1 rawcount
+# 12 12 rawcount
+# 14 34830 counter
+# 16 18437 counter
+
+def inventory_winperf_tcp_conn(info):
+ return [ (None, {}) ]
+
+def check_winperf_tcp_conn(item, params, info):
+ fields = [
+ ( 2, "Established", "ESTABLISHED" ),
+ ]
+ infotext = ""
+ worst_state = 0
+ for offset, name, param_key in fields:
+ value = saveint(info[offset][1])
+ infotext += "%s: %s" % (name, value)
+ if params.get(param_key):
+ warn, crit = params.get(param_key)
+ if value >= crit:
+ worst_state = 2
+ infotext += "(!!) (critical at %d)" % crit
+ elif value >= warn:
+ worst_state = max(1, worst_state)
+ infotext += "(!) (warning at %d)" % warn
+ infotext += ", "
+
+ infotext = infotext[:-2]
+ return (worst_state, infotext)
+
+check_info["winperf_tcp_conn"] = {
+ 'check_function': check_winperf_tcp_conn,
+ 'inventory_function': inventory_winperf_tcp_conn,
+ 'service_description': 'TCP connections',
+ 'has_perfdata': True,
+ 'group': 'tcp_conn_stats_win',
+}
+
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index d85cdc1..10477d2 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -983,8 +983,30 @@ register_check_parameters(
register_check_parameters(
subgroup_networking,
+ "tcp_conn_stats_win",
+ ("TCP connection stats (Windows)"),
+ Dictionary(
+ elements = [
+ ( "ESTABLISHED",
+ Tuple(
+ title = _("ESTABLISHED"),
+ help = _("connection up and passing data"),
+ elements = [
+ Integer(title = _("Warning at"), label =
_("connections")),
+ Integer(title = _("Critical at"), label =
_("connections"))
+ ]
+ )
+ )
+ ]
+ ),
+ None,
+ "first"
+)
+
+register_check_parameters(
+ subgroup_networking,
"tcp_conn_stats",
- ("TCP connection stats"),
+ ("TCP connection stats (LINUX / UNIX)"),
Dictionary(
elements = [
( "ESTABLISHED",