[Nagiosplug-checkins] CVS: nagiosplug/plugins check_disk.c,1.15,1.16
Karl DeBisschop
kdebisschop at users.sourceforge.net
Fri Mar 21 06:09:02 CET 2003
Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv8679/plugins
Modified Files:
check_disk.c
Log Message:
checkpoint, allows selecting devices and paths now
Index: check_disk.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_disk.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** check_disk.c 19 Mar 2003 12:59:38 -0000 1.15
--- check_disk.c 21 Mar 2003 14:08:01 -0000 1.16
***************
*** 92,99 ****
/* A filesystem type to display. */
! struct fs_type_list
{
! char *fs_name;
! struct fs_type_list *fs_next;
};
--- 92,99 ----
/* A filesystem type to display. */
! struct name_list
{
! char *name;
! struct name_list *name_next;
};
***************
*** 109,118 ****
4.2 4.3 ufs nfs swap ignore io vm efs dbg */
! static struct fs_type_list *fs_select_list;
/* Linked list of filesystem types to omit.
If the list is empty, don't exclude any types. */
! static struct fs_type_list *fs_exclude_list;
/* Linked list of mounted filesystems. */
--- 109,122 ----
4.2 4.3 ufs nfs swap ignore io vm efs dbg */
! static struct name_list *fs_select_list;
/* Linked list of filesystem types to omit.
If the list is empty, don't exclude any types. */
! static struct name_list *fs_exclude_list;
!
! static struct name_list *path_select_list;
!
! static struct name_list *dev_select_list;
/* Linked list of mounted filesystems. */
***************
*** 170,195 ****
char *disk;
if (process_arguments (argc, argv) != OK)
usage ("Could not parse arguments\n");
- 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);
}
- }
terminate (result, "DISK %s %s\n", state_text (result), output);
--- 174,207 ----
char *disk;
+ mount_list = read_filesystem_list (0);
+
if (process_arguments (argc, argv) != OK)
usage ("Could not parse arguments\n");
for (me = mount_list; me; me = me->me_next) {
!
! if ((dev_select_list &&
! ! strcmp (dev_select_list->name, me->me_devname)) ||
! (path_select_list &&
! ! strcmp (path_select_list->name, me->me_mountdir)))
! get_fs_usage (me->me_mountdir, me->me_devname, &fsp);
! else if (dev_select_list || path_select_list)
! continue;
! else
! 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 MB (%2.0f%%) free on %s\n",
output,
! fsp.fsu_bavail*fsp.fsu_blocksize/1024/1024,
! fsp.fsu_blocks*fsp.fsu_blocksize/1024/1024,
(double)fsp.fsu_bavail*100/fsp.fsu_blocks,
! display_mntp ? me->me_devname : me->me_mountdir);
}
+ }
terminate (result, "DISK %s %s\n", state_text (result), output);
***************
*** 201,204 ****
--- 213,219 ----
{
int c;
+ struct name_list *se;
+ struct name_list **pathtail = &path_select_list;
+ struct name_list **devtail = &dev_select_list;
int option_index = 0;
***************
*** 214,217 ****
--- 229,233 ----
{"help", no_argument, 0, 'h'},
{"mountpoint", no_argument, 0, 'm'},
+ {"device", no_argument, 0, 'd'},
{"exclude_device", required_argument, 0, 'x'},
{"quiet", no_argument, 0, 'q'},
***************
*** 228,232 ****
while (1) {
! c = getopt_long (argc, argv, "+?Vqhvet:c:w:p:x:m", long_options, &option_index);
if (c == -1 || c == EOF)
--- 244,248 ----
while (1) {
! c = getopt_long (argc, argv, "+?Vqhvet:c:w:p:d:x:m", long_options, &option_index);
if (c == -1 || c == EOF)
***************
*** 275,279 ****
}
case 'p': /* path or partition */
! path = optarg;
break;
case 'v': /* verbose */
--- 291,304 ----
}
case 'p': /* path or partition */
! se = (struct name_list *) malloc (sizeof (struct name_list));
! se->name = strdup (optarg);
! *pathtail = se;
! pathtail = &se->name_next;
! break;
! case 'd': /* path or partition */
! se = (struct name_list *) malloc (sizeof (struct name_list));
! se->name = strdup (optarg);
! *devtail = se;
! devtail = &se->name_next;
break;
case 'v': /* verbose */
More information about the Commits
mailing list