Module: check_mk
Branch: master
Commit: 1d1b534c45fc6958d6686554bb36d8284ac52579
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1d1b534c45fc69…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue Aug 23 13:19:02 2016 +0200
3789 f5_bigip_snat: new check for source NAT monitoring
---
.werks/3789 | 9 +++++
ChangeLog | 1 +
checkman/f5_bigip_snat | 16 +++++++++
checks/f5_bigip_snat | 92 ++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 118 insertions(+)
diff --git a/.werks/3789 b/.werks/3789
new file mode 100644
index 0000000..679d9c5
--- /dev/null
+++ b/.werks/3789
@@ -0,0 +1,9 @@
+Title: f5_bigip_snat: new check for source NAT monitoring
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.4.0i1
+Date: 1471951106
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index b5c9dc5..e734b4a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -134,6 +134,7 @@
* 3777 ipmi: IPMI sensor states are configurable
* 3778 if: now levels for discards rate are configurable
* 3788 f5_big_pool: check is now cluster ready
+ * 3789 f5_bigip_snat: new check for source NAT monitoring
* 3073 FIX: windows agent: relative paths to mrpe scripts are now treated as relative
to the agent installation directory...
* 3061 FIX: mk_jolokia: Fixed debugging of the agent plugin
* 3074 FIX: windows agent: fixed incorrect values for 32-bit performance counters
diff --git a/checkman/f5_bigip_snat b/checkman/f5_bigip_snat
new file mode 100644
index 0000000..acd42dd
--- /dev/null
+++ b/checkman/f5_bigip_snat
@@ -0,0 +1,16 @@
+title: F5 Big-IP: Source NAT
+agents: snmp
+catalog: hw/network/f5
+license: GPL
+distribution: check_mk
+description:
+ The check queries the MIB tables of F5 BIG-IP load balancers (local traffic
+ managers) and collects statistical information about the source NAT.
+ It shows the number if incoming and outgoing bytes and packets, the connection rate
+ and the current connections.
+
+perfdata:
+ Incoming/Outgoing bytes and packet. The connection rate and the current connections.
+
+inventory:
+ One check is generated per source NAT.
diff --git a/checks/f5_bigip_snat b/checks/f5_bigip_snat
new file mode 100644
index 0000000..64a8e66
--- /dev/null
+++ b/checks/f5_bigip_snat
@@ -0,0 +1,92 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2014 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-
+# tails. 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.
+
+def parse_f5_bigip_snat(info):
+ snats = {}
+ for line in info:
+ name = line[0]
+ snats.setdefault(name, {})
+ snats[name].setdefault("if_in_pkts" ,
[]).append(int(line[1])),
+ snats[name].setdefault("if_out_pkts" ,
[]).append(int(line[2])),
+ snats[name].setdefault("if_in_octets" ,
[]).append(int(line[3])),
+ snats[name].setdefault("if_out_octets" ,
[]).append(int(line[4])),
+ snats[name].setdefault("connections_rate" ,
[]).append(int(line[5])),
+ snats[name].setdefault("connections" ,
[]).append(int(line[6])),
+ return snats
+
+def inventory_f5_bigip_snat(parsed):
+ for name, snat in parsed.items():
+ yield name, None
+
+def check_f5_bigip_snat(item, _no_params, parsed):
+ if item in parsed:
+ snat = parsed[item]
+
+ summed_values = {}
+ now = time.time()
+ # Calculate counters
+ for what in [
+ "if_in_pkts",
+ "if_out_pkts",
+ "if_in_octets",
+ "if_out_octets",
+ "connections_rate",
+ ]:
+ summed_values.setdefault(what, 0)
+ for idx, entry in enumerate(snat[what]):
+ rate = get_rate("%s.%s" % (what, idx), now, entry)
+ summed_values[what] += rate
+
+ # Calculate sum value
+ for what, function in [ ("connections", sum) ]:
+ summed_values[what] = function(snat[what])
+
+ perfdata = map(lambda x: (x[0], x[1]), summed_values.items())
+
+ # Current number of connections
+ yield 0, "Client connections: %d" %
summed_values["connections"], perfdata
+
+ # New connections per time
+ yield 0, "Rate: %.2f/sec" %
summed_values["connections_rate"]
+
+check_info["f5_bigip_snat"] = {
+ "parse_function" : parse_f5_bigip_snat,
+ "check_function" : check_f5_bigip_snat,
+ "inventory_function" : inventory_f5_bigip_snat,
+ "service_description" : "Source NAT %s",
+ "has_perfdata" : True,
+ "snmp_info" : (".1.3.6.1.4.1.3375.2.2.9.2.3.1", [
+ "1", #ltmSnatStatName
+ "2", #ltmSnatStatClientPktsIn
+ "3", #ltmSnatStatClientBytesIn
+ "4", #ltmSnatStatClientPktsOut
+ "5", #ltmSnatStatClientBytesOut
+ "7", #ltmSnatStatClientTotConns
+ "8", #ltmSnatStatClientCurConns
+ ]),
+ "snmp_scan_function" : lambda oid: ".1.3.6.1.4.1.3375.2" in
oid(".1.3.6.1.2.1.1.2.0") \
+ and "big-ip" in
oid(".1.3.6.1.4.1.3375.2.1.4.1.0").lower(),
+}