Module: check_mk
Branch: master
Commit: d8516abc6edfb3f16da8cb765691dc20aa797dd8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d8516abc6edfb3…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Oct 29 19:23:24 2010 +0200
nfsmounts: fix output of used space
---
ChangeLog | 1 +
checkman/nfsmounts | 40 +++++++++++++++++++---------------------
checks/nfsmounts | 6 ++++--
3 files changed, 24 insertions(+), 23 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 64eb7ac..567f5b3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -19,6 +19,7 @@
* hp_proliant_psu: Fixed multiple PSU detection on one system (Thanks to Andreas
Döhler)
* megaraid_pdisks: Fixed coding error
* cisco_fan: fixed check bug in case of critical state
+ * nfsmounts: fix output (free and used was swapped), make output identical to df
Livestatus:
* Prohibit { and } in regular expressions. This avoids a segmentation
diff --git a/checkman/nfsmounts b/checkman/nfsmounts
index 0f87c98..561d307 100644
--- a/checkman/nfsmounts
+++ b/checkman/nfsmounts
@@ -4,37 +4,35 @@ author: Mathias Kettner <mk(a)mathias-kettner.de>
license: GPL
distribution: check_mk
description:
- This check probes the availability of NFS mounts. The
- Linux agent sends the status of all NFS mounts, if the
- command line utility {maxwait} is available (it is
- is used to avoid hanging if the NFS server is not
- responding). The probe is done by trying a {stat -f}
- (system call {statfs(2)}) on the mount point. If that
- lasts longer then 2 seconds, then the server is considered
+ This check probes the availability of NFS mounts. The Linux agent sends the
+ status of all NFS mounts, if the command line utility {maxwait} is available
+ (it is is used to avoid hanging if the NFS server is not responding). The
+ probe is done by trying a {stat -f} (system call {statfs(2)}) on the mount
+ point. If that lasts longer then 2 seconds, then the server is considered
to be not responding.
- When you install the Linux agent manually, please
- do not forget to also install {waitmax} into {/usr/bin}.
- That file is shipped together with the agent. When
- {waitmax} is missing, the agent will silently omit
- the section {nfsmounts}.
+ When you install the Linux agent manually, please do not forget to also
+ install {waitmax} into {/usr/bin}. That file is shipped together with
+ the agent. When {waitmax} is missing, the agent will silently omit the
+ section {nfsmounts}.
- If the NFS mount is "stale", then {stat -f} returns immediately
- but with a size of {-1}. The check detects that and results
- in a warning state.
+ If the NFS mount is "stale", then {stat -f} returns immediately but with
+ a size of {-1}. The check detects that and results in a warning state.
+
+ Please note, that though this check outputs the current usage of the remote
+ filesystem, no levels can be defined for the used space and no performance
+ data is output. Please do a check for used space directly on the NFS server.
item:
The mount point.
perfdata:
- This check does not provide performance data. The disk
- usage is assumedly measured on the file server itself.
- Duplicating that data on all clients would unneccessarily
- create redundant RRDs.
+ This check does not provide performance data. The disk usage is assumedly
+ measured on the file server itself. Duplicating that data on all clients
+ would unneccessarily create redundant RRDs.
inventory:
- All NFS mounts are found automatically. This is not
+ All NFS mounts are found automatically. This is done
by scanning {/proc/mounts}. The file {/etc/fstab}
is irrelevant.
-
diff --git a/checks/nfsmounts b/checks/nfsmounts
index 97fd749..ed73e04 100644
--- a/checks/nfsmounts
+++ b/checks/nfsmounts
@@ -41,9 +41,11 @@ def check_nfsmounts(item, params, info):
gb = 1024 * 1024 * 1024.0
size_gb = (size_blocks * blocksize) / gb
- used_gb = (free_blocks * blocksize) / gb
+ free_gb = (free_blocks * blocksize) / gb
+ used_gb = size_gb - free_gb
+ used_perc = 100.0 * used_gb / size_gb
if line[1] == 'ok':
- return (0, "OK - server responding (%.2f GB / %.2f GB used)" %
(used_gb, size_gb))
+ return (0, "OK - %.1f%% used (%.1f of %.1f GB)" % (used_perc,
used_gb, size_gb))
else:
return (2, "CRITICAL - server not responding")
return (3, "UNKNOWN - not mounted")