diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2006-10-18 12:12:11 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2006-10-18 12:12:11 +0000 |
commit | 584562a48ea731a3bf98d66c6602c64e1e72c63a (patch) | |
tree | 988ffe437d34ea8ba4be62f5576277eb4c41e7a2 /plugins | |
parent | 450ad346edcf2304087ffa74a46eef274336c16b (diff) | |
download | monitoring-plugins-584562a48ea731a3bf98d66c6602c64e1e72c63a.tar.gz |
Re-added perf data to check_disk
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1498 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_disk.c | 27 | ||||
-rw-r--r-- | plugins/t/check_disk.t | 2 |
2 files changed, 25 insertions, 4 deletions
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 3c7b0ecf..a88d2a1b 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c @@ -159,6 +159,8 @@ main (int argc, char **argv) double dfree_pct = -1, dused_pct = -1; double dused_units, dfree_units, dtotal_units; double dused_inodes_percent, dfree_inodes_percent; + double warning_high_tide = UINT_MAX; + double critical_high_tide = UINT_MAX; int temp_result; struct mount_entry *me; @@ -284,13 +286,30 @@ main (int argc, char **argv) result = max_state(result, disk_result); + /* What a mess of units. The output shows free space, the perf data shows used space. Yikes! + Hack here. Trying to get warn/crit levels from freespace_(units|percent) for perf + data. Assumption that start=0. Roll on new syntax... + */ + if (path->freespace_units->warning != NULL) { + warning_high_tide = dtotal_units - path->freespace_units->warning->end; + } + if (path->freespace_percent->warning != NULL) { + warning_high_tide = abs( min( (double) warning_high_tide, (double) (1.0 - path->freespace_percent->warning->end/100)*dtotal_units )); + } + if (path->freespace_units->critical != NULL) { + critical_high_tide = dtotal_units - path->freespace_units->critical->end; + } + if (path->freespace_percent->critical != NULL) { + critical_high_tide = abs( min( (double) critical_high_tide, (double) (1.0 - path->freespace_percent->critical->end/100)*dtotal_units )); + } + asprintf (&perf, "%s %s", perf, perfdata ((!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir, dused_units, units, - FALSE, 0, /* min ((uintmax_t)dtotal_units-(uintmax_t)w_df, (uintmax_t)((1.0-w_dfp/100.0)*dtotal_units)), */ - FALSE, 0, /* min ((uintmax_t)dtotal_units-(uintmax_t)c_df, (uintmax_t)((1.0-c_dfp/100.0)*dtotal_units)), */ - FALSE, 0, /* inode_space_pct - this is not meant to be here???, */ - FALSE, 0));; /* dtotal_units)); */ + TRUE, warning_high_tide, + TRUE, critical_high_tide, + TRUE, 0, + TRUE, dtotal_units)); if (disk_result==STATE_OK && erronly && !verbose) continue; diff --git a/plugins/t/check_disk.t b/plugins/t/check_disk.t index ec3d248c..e8e35b9f 100644 --- a/plugins/t/check_disk.t +++ b/plugins/t/check_disk.t @@ -5,6 +5,8 @@ # $Id$ # +# TODO: Add in tests for perf data. Need to beef up Nagios::Plugin::Performance to cater for max, min, etc + use strict; use Test::More; use NPTest; |