Module: check_mk
Branch: master
Commit: b0f960688490c3da722414c9da294bc632449547
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b0f960688490c3…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Fri Oct 13 13:42:24 2017 +0200
5226 netstat, win_netstat: Checks now include performance graphs for number of
connections
Change-Id: If0187520250194083828fe0278dc12a7ae87defd
---
.werks/5226 | 10 ++++++++++
checks/netstat | 1 +
checks/netstat.include | 5 ++++-
checks/win_netstat | 1 +
4 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/.werks/5226 b/.werks/5226
new file mode 100644
index 0000000..94ee88e
--- /dev/null
+++ b/.werks/5226
@@ -0,0 +1,10 @@
+Title: netstat, win_netstat: Checks now include performance graphs for number of
connections
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1507894897
+Class: feature
+
+
diff --git a/checks/netstat b/checks/netstat
index 6176f3f..a7d6975 100644
--- a/checks/netstat
+++ b/checks/netstat
@@ -84,5 +84,6 @@ check_info["netstat"] = {
'service_description' : "TCP Connection %s",
'group' : "tcp_connections",
'includes' : [ "netstat.include" ],
+ 'has_perfdata' : True,
}
diff --git a/checks/netstat.include b/checks/netstat.include
index a57cdad..1b95bdc 100644
--- a/checks/netstat.include
+++ b/checks/netstat.include
@@ -69,6 +69,7 @@ def check_netstat_generic(item, params, connections):
if params.get("max_states"):
max_warn, max_crit = params["max_states"]
+ perfdata = [ ("connections", found, max_warn, max_crit) ]
if found >= max_crit:
max_state = 2
elif found >= max_warn:
@@ -78,6 +79,8 @@ def check_netstat_generic(item, params, connections):
if max_state:
states.append(max_state)
infotext += " (warn/crit at %d/%d)" % (max_warn, max_crit)
+ else:
+ perfdata = [ ("connections", found) ]
- yield max(states), infotext
+ yield max(states), infotext, perfdata
diff --git a/checks/win_netstat b/checks/win_netstat
index 3853095..f7978fd 100644
--- a/checks/win_netstat
+++ b/checks/win_netstat
@@ -87,4 +87,5 @@ check_info["win_netstat"] = {
'service_description' : "TCP Connection %s",
'group' : "tcp_connections",
'includes' : [ "netstat.include" ],
+ 'has_perfdata' : True,
}