Module: check_mk
Branch: master
Commit: 529a09479d4a39ca3f5063685ff1674445e201fb
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=529a09479d4a39…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Mon May 4 11:10:13 2015 +0200
#2076 fortigate_cpu_base, fortigate_sessions_base: supports wider range of models
These two new checks aquire their data through the MIB FORTINET-FORTIGATE-MIB.
---
.werks/2076 | 9 ++++++
ChangeLog | 1 +
checks/fortigate_cpu_base | 60 ++++++++++++++++++++++++++++++++++++++++
checks/fortigate_sessions_base | 57 ++++++++++++++++++++++++++++++++++++++
4 files changed, 127 insertions(+)
diff --git a/.werks/2076 b/.werks/2076
new file mode 100644
index 0000000..a49895f
--- /dev/null
+++ b/.werks/2076
@@ -0,0 +1,9 @@
+Title: fortigate_cpu_base, fortigate_sessions_base: supports wider range of models
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i1
+Date: 1430730391
+Class: feature
+
+These two new checks aquire their data through the MIB FORTINET-FORTIGATE-MIB.
diff --git a/ChangeLog b/ChangeLog
index 3845898..bc69311 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -171,6 +171,7 @@
* 1242 enterasys_powersupply: It's now possible to choice which redundancy state
treated as OK...
* 2214 icom_repeater: New set of checks for Icom repeaters...
* 2245 AIX-Agent: Added support for the uptime check
+ * 2076 fortigate_cpu_base, fortigate_sessions_base: supports wider range of
models...
* 1457 FIX: logins: new check renamed from "users" check...
NOTE: Please refer to the migration notes!
* 1762 FIX: lnx_thermal: Now ignoring trip points with level 0...
diff --git a/checks/fortigate_cpu_base b/checks/fortigate_cpu_base
new file mode 100644
index 0000000..13301f3
--- /dev/null
+++ b/checks/fortigate_cpu_base
@@ -0,0 +1,60 @@
+#!/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-
+# 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.
+
+fortigate_cpu_base_default_levels = (80.0, 90.0)
+
+def inventory_fortigate_cpu_base(info):
+ return [(None, "fortigate_cpu_base_default_levels")]
+
+def check_fortigate_cpu_base(item, params, info):
+ num_cpus = 0
+ util = 0
+ for line in info:
+ util += int(line[0])
+ num_cpus += 1
+ if num_cpus == 0:
+ return
+
+ util = float(util) / num_cpus
+
+ state, infotext, perfdata = check_cpu_util(util, params)
+ infotext += " at %d CPUs" % num_cpus
+
+ return state, infotext, perfdata
+
+check_info["fortigate_cpu_base"] = {
+ "inventory_function" : inventory_fortigate_cpu_base,
+ "check_function" : check_fortigate_cpu_base,
+ "service_description" : "CPU utilization",
+ "has_perfdata" : True,
+ "group" : "cpu_utilization",
+ # uses mib FORTINET-FORTIGATE-MIB
+ "snmp_scan_function" : lambda oid: ".1.3.6.1.4.1.12356.101.1"
in oid(".1.3.6.1.2.1.1.2.0") and\
+ oid(".1.3.6.1.4.1.12356.101.4.1.3.0"),
+ "snmp_info" : ( ".1.3.6.1.4.1.12356.101.4.1", [ 3 ]),
+ "include" : [ "cpu_util.include" ],
+}
+
diff --git a/checks/fortigate_sessions_base b/checks/fortigate_sessions_base
new file mode 100644
index 0000000..3786a5f
--- /dev/null
+++ b/checks/fortigate_sessions_base
@@ -0,0 +1,57 @@
+#!/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-
+# 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.
+
+fortigate_sessions_base_default_levels = (100000, 150000)
+
+def inventory_fortigate_sessions_base(info):
+ return [(None, "fortigate_sessions_base_default_levels")]
+
+def check_fortigate_sessions_base(item, params, info):
+ warn, crit = params
+ current = saveint(info[0][0])
+ state = 0
+ icon = ''
+ if current >= warn:
+ state = 1
+ icon = "(!)"
+ if current >= crit:
+ state = 2
+ icon = "(!!)"
+
+ perf = [("session", current, warn, crit)]
+ return state, "%d Session%s (levels at %d/%d)" % (current, icon, warn,
crit), perf
+
+check_info["fortigate_sessions_base"] = {
+ "inventory_function" : inventory_fortigate_sessions_base,
+ "check_function" : check_fortigate_sessions_base,
+ "service_description" : "Sessions",
+ "has_perfdata" : True,
+ # uses mib FORTINET-FORTIGATE-MIB
+ "snmp_scan_function" : lambda oid: ".1.3.6.1.4.1.12356.101.1"
in oid(".1.3.6.1.2.1.1.2.0") and\
+ oid(".1.3.6.1.4.1.12356.101.4.1.8.0"),
+ "snmp_info" : ( ".1.3.6.1.4.1.12356.101.4.1", [ 8 ]),
+}
+