Module: check_mk
Branch: master
Commit: 21fa5a86dedbd84b0f9d156edff84be7034d062b
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=21fa5a86dedbd8…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Aug 12 09:58:48 2016 +0200
cppcheck tweaks.
---
livestatus/src/module.cc | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/livestatus/src/module.cc b/livestatus/src/module.cc
index bb126fd..396441e 100644
--- a/livestatus/src/module.cc
+++ b/livestatus/src/module.cc
@@ -881,7 +881,8 @@ void omd_advertize() {
}
}
-/* this function gets called when the module is loaded by the event broker */
+// Called from Nagios after we have been loaded.
+// cppcheck-suppress unusedFunction
extern "C" int nebmodule_init(int flags __attribute__((__unused__)), char *args,
void *handle) {
g_nagios_handle = handle;
@@ -930,6 +931,8 @@ extern "C" int nebmodule_init(int flags __attribute__((__unused__)), char *args,
return 0;
}
+// Called from Nagios after before we are unloaded.
+// cppcheck-suppress unusedFunction
extern "C" int nebmodule_deinit(int flags __attribute__((__unused__)),
int reason __attribute__((__unused__))) {
logger(LG_INFO, "deinitializing");
Module: check_mk
Branch: master
Commit: 4f476d375e08b2bdc9c10cd761174d476a2e30a0
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4f476d375e08b2…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Aug 11 15:48:59 2016 +0200
3783 netapp_api_qtree_quota: new check to monitor disk usage of qtrees
---
.werks/3783 | 9 ++++++
ChangeLog | 1 +
agents/special/agent_netapp | 23 ++++++++++++--
checkman/netapp_api_qtree_quota | 48 ++++++++++++++++++++++++++++
checks/netapp_api_qtree_quota | 66 +++++++++++++++++++++++++++++++++++++++
5 files changed, 145 insertions(+), 2 deletions(-)
diff --git a/.werks/3783 b/.werks/3783
new file mode 100644
index 0000000..acd0bf7
--- /dev/null
+++ b/.werks/3783
@@ -0,0 +1,9 @@
+Title: netapp_api_qtree_quota: new check to monitor disk usage of qtrees
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.4.0i1
+Date: 1470923312
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index ac02ae2..7173e95 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -124,6 +124,7 @@
* 3732 esx_vsphere_hostsystem.mem_usage esx_vsphere_hostsystem.mem_usage_cluster: Providing mem_total as dedicated metric
* 3712 ispro_sensors_temp, ispro_sensors_humid, ispro_sensors_digital: new checks which monitor Interseptro Pro devices which support the ISPRO-MIB
* 3560 emcvnx_disks: now able to configure states for hard read/write errors and when enclosure rebuilds
+ * 3783 netapp_api_qtree_quota: new check to monitor disk usage of qtrees
* 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/agents/special/agent_netapp b/agents/special/agent_netapp
index 13cb323..4fa3d19 100755
--- a/agents/special/agent_netapp
+++ b/agents/special/agent_netapp
@@ -318,10 +318,10 @@ def query_nodes(what, node_attribute = "node-name"):
section_errors = []
def query(what, return_toplevel_node = False):
- # HACK: if "what" endswith get-iter, add max_records = 5000
+ # HACK: if "what" endswith "iter", add max_records = 5000
# This approach is way easier than reading the tag, invoke another
# command and merge all answers together
- if what.endswith("get-iter"):
+ if what.endswith("iter"):
response = server.invoke(what, "max-records", 5000)
else:
response = server.invoke(what)
@@ -665,6 +665,15 @@ if netapp_mode == "clustermode":
if node in ha_partners:
processed_nodes.append(ha_partners[node])
+ # Qtree quota usage (# UNTESTED! #)
+ quota_info = query("quota-report-iter")
+ if quota_info:
+ print "<<<netapp_api_qtree_quota:sep(9)>>>"
+ print format_config(quota_info, "quota", "tree",
+ config_report = ["volume", "tree", "disk-limit", "disk-used",
+ "quota-type", "quota-users.quota-user.quota-user-name"],
+ config_rename = {"quota-users.quota-user.quota-user-name": "quota-users"})
+
#.
# .--7Mode Settings------------------------------------------------------.
@@ -836,6 +845,16 @@ else:
if licensev2_info:
print format_config(licensev2_info, "license", "package")
+ # Qtree quota usage
+ quota_info = query("quota-report")
+ if quota_info:
+ print "<<<netapp_api_qtree_quota:sep(9)>>>"
+ print format_config(quota_info, "quota", "tree",
+ config_report = ["volume", "tree", "disk-limit", "disk-used",
+ "quota-type", "quota-users.quota-user.quota-user-name"],
+ config_rename = {"quota-users.quota-user.quota-user-name": "quota-users"})
+
+
#
#print "<<<netapp_errors>>>"
#import pprint
diff --git a/checkman/netapp_api_qtree_quota b/checkman/netapp_api_qtree_quota
new file mode 100644
index 0000000..f502039
--- /dev/null
+++ b/checkman/netapp_api_qtree_quota
@@ -0,0 +1,48 @@
+title: NetApp Filers: Used space of qtrees in volumes
+agents: netapp
+catalog: hw/storagehw/netapp
+license: GPL
+distribution: check_mk
+description:
+ This check measures the disk usage of qtrees. The usage
+ is checked against a warning and a critical level, which
+ can be specified in numerous ways.
+
+ {Trends:} This checks supports aggregation {trends}. This means that the {netapp_api_qtree_quota} check
+ is able to compute the {change} of the used space over the time and can
+ make a forecast into the future. It can estimate the time when
+ the aggregation will be full.
+
+ In the default configuration the check will compute the trend based on the
+ data of the last 24 hours using a logarithmic average that gives more recent
+ data a higher weight. Also data beyond the 24 hours will to some small degree be
+ reflected in the computation. The advantage of this algorithm is a more
+ precise prediction and a simpler implementation, which does not need any
+ access to any RRDs or similar storage.
+
+ Please note that when a aggregation is started to be monitored,
+ the trend of the past is unknown and is assumed to be {zero}.
+ It will take at least one trend range of time until the trend
+ approximately reflects the reality.
+
+item:
+ Name of the qtree as defined in the system
+
+examples:
+ # Example configuration with usage levels at 75%/90%, trend enabled
+ # and performance data for global, nfs, fcp and iscsi
+ checkgroup_parameters['filesystem'] = [
+ ( {'trend_range': 24,
+ 'trend_mb': (100, 200),
+ 'trend_showtimeleft': True,
+ 'trend_perc': (5.0, 10.0),
+ 'trend_perfdata': True},
+ 'levels': (75.0, 90.0),
+ [], ALL_HOSTS, ALL_SERVICES ),
+ ] + checkgroup_parameters['filesystem']
+
+
+inventory:
+ All qtrees with the quota-type {tree} are detected upon inventory.
+ {User} and {group} quota types are not shown.
+
diff --git a/checks/netapp_api_qtree_quota b/checks/netapp_api_qtree_quota
new file mode 100644
index 0000000..24e49f3
--- /dev/null
+++ b/checks/netapp_api_qtree_quota
@@ -0,0 +1,66 @@
+#!/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.
+
+# <<<netapp_api_qtree_quota:sep(9)>>>
+# quota user01 quota-type user disk-limit 12288000 quota-users AD\aolov volume vol_silber2_group_cifs disk-used 0
+# quota user01 quota-type user disk-limit 12288000 quota-users AD\bva volume vol_silber2_group_cifs disk-used 0
+# quota user01 quota-type user disk-limit 12288000 quota-users AD\cclze volume vol_silber2_group_cifs disk-used 0
+# quota fdo01 quota-type tree disk-limit 4294967296 volume vol_bronze1_fdo1 disk-used 3544121572
+# quota fdo03 quota-type tree disk-limit 2684354560 volume vol_bronze1_fdo2 disk-used 788905236
+
+def inventory_netapp_api_qtree_quota(parsed):
+ for qtree, attrs in parsed.items():
+ if attrs.get("quota-type") == "tree":
+ yield qtree, {}
+
+def check_netapp_api_qtree_quota(item, params, parsed):
+ qtree = parsed.get(item)
+
+ if not qtree:
+ return 3, "Qtree not found in agent output"
+
+ size_total = int(qtree.get("disk-limit")) / 1024.0
+ size_avail = size_total - int(qtree.get("disk-used")) / 1024.0
+ if qtree.get("files-used", "").isdigit() and qtree.get("file-limit", "").isdigit():
+ inodes_total = int(qtree.get("file-limit"))
+ inodes_avail = inodes_total - int(qtree.get("files-used"))
+ else:
+ inodes_total = None
+ inodes_avail = None
+
+ return df_check_filesystem_single(g_hostname, item, size_total, size_avail, 0,
+ inodes_total, inodes_avail, params)
+
+check_info["netapp_api_qtree_quota"] = {
+ 'check_function' : check_netapp_api_qtree_quota,
+ 'inventory_function' : inventory_netapp_api_qtree_quota,
+ 'parse_function' : lambda info: netapp_api_parse_lines(info, custom_keys = ["quota", "quota-users"]),
+ 'service_description' : 'Qtree %s',
+ 'has_perfdata' : True,
+ 'group' : "filesystem",
+ 'includes' : [ "df.include", "netapp_api.include" ],
+ "default_levels_variable" : "filesystem_default_levels",
+}