aboutsummaryrefslogtreecommitdiff
path: root/plugins/check_disk.c
diff options
context:
space:
mode:
authorGravatar Karl DeBisschop <kdebisschop@users.sourceforge.net> 2003-03-19 12:59:38 +0000
committerGravatar Karl DeBisschop <kdebisschop@users.sourceforge.net> 2003-03-19 12:59:38 +0000
commit8535da68ef4fdd8ccebc9a0fe72bf3bf61e71f65 (patch)
treeade919c5add626d726a0da292fe0b798590aa173 /plugins/check_disk.c
parent9b11e0b65227e4e92b5d3f49a45fa7928dc7c113 (diff)
downloadmonitoring-plugins-8535da68ef4fdd8ccebc9a0fe72bf3bf61e71f65.tar.gz
check_disk working with mountlist.c
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@439 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_disk.c')
-rw-r--r--plugins/check_disk.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/plugins/check_disk.c b/plugins/check_disk.c
index 2558f6d3..f9a9a847 100644
--- a/plugins/check_disk.c
+++ b/plugins/check_disk.c
@@ -63,6 +63,7 @@ const char *options = "\
#include "utils.h"
#include <stdarg.h>
#include "../lib/fsusage.h"
+#include "../lib/mountlist.h"
/* If nonzero, show inode information. */
static int inode_format;
@@ -146,6 +147,8 @@ int verbose = 0;
int erronly = FALSE;
int display_mntp = FALSE;
+/* Linked list of mounted filesystems. */
+static struct mount_entry *mount_list;
int
main (int argc, char **argv)
@@ -162,22 +165,32 @@ main (int argc, char **argv)
char mntp[MAX_INPUT_BUFFER];
char *output = "";
+ struct mount_entry *me;
struct fs_usage fsp;
char *disk;
if (process_arguments (argc, argv) != OK)
usage ("Could not parse arguments\n");
- get_fs_usage (path, disk, &fsp);
+ mount_list = read_filesystem_list (0);
+
+ for (me = mount_list; me; me = me->me_next) {
+ get_fs_usage (me->me_mountdir, me->me_devname, &fsp);
+ if (fsp.fsu_blocks && strcmp ("none", me->me_mountdir)) {
+ usp = (fsp.fsu_blocks - fsp.fsu_bavail) * 100 / fsp.fsu_blocks;
+ disk_result = check_disk (usp, fsp.fsu_bavail);
+ result = max_state (disk_result, result);
+ asprintf (&output, "%s %llu of %llu kB (%2.0f%%) free (%d-byte blocks) on %s (%s) %d\n",
+ output,
+ fsp.fsu_bavail*fsp.fsu_blocksize/1024,
+ fsp.fsu_blocks*fsp.fsu_blocksize/1024,
+ (double)fsp.fsu_bavail*100/fsp.fsu_blocks,
+ fsp.fsu_blocksize,
+ me->me_mountdir,
+ me->me_type, usp);
+ }
+ }
- usp = (fsp.fsu_blocks - fsp.fsu_bavail) / fsp.fsu_blocks;
- disk_result = check_disk (usp, fsp.fsu_bavail);
- result = disk_result;
- asprintf (&output, "%llu of %llu kB (%2.0f%%) free (%d-byte blocks)",
- fsp.fsu_bavail*fsp.fsu_blocksize/1024,
- fsp.fsu_blocks*fsp.fsu_blocksize/1024,
- (double)fsp.fsu_bavail*100/fsp.fsu_blocks,
- fsp.fsu_blocksize);
terminate (result, "DISK %s %s\n", state_text (result), output);
}