[Nagiosplug-checkins] CVS: nagiosplug/plugins check_disk.c,1.22,1.23

Ton Voon tonvoon at users.sourceforge.net
Wed Jun 25 06:30:07 CEST 2003


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv29135

Modified Files:
	check_disk.c 
Log Message:
Report errors if path specified not found


Index: check_disk.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_disk.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -r1.22 -r1.23
*** check_disk.c	25 Jun 2003 13:16:53 -0000	1.22
--- check_disk.c	25 Jun 2003 13:28:05 -0000	1.23
***************
*** 107,110 ****
--- 107,111 ----
  {
    char *name;
+   int found;
    struct name_list *name_next;
  };
***************
*** 191,194 ****
--- 192,196 ----
  	struct mount_entry *me;
  	struct fs_usage fsp;
+ 	struct name_list *temp_list;
  	char *disk;
  
***************
*** 253,256 ****
--- 255,268 ----
  		asprintf (&output, "%s%s", output, details);
  
+ 	/* Override result if paths specified and not found */
+ 	temp_list = path_select_list;
+ 	while (temp_list) {
+ 		if (temp_list->found != TRUE) {
+ 			asprintf (&output, "%s [%s not found]", output, temp_list->name);
+ 			result = STATE_CRITICAL;
+ 		}
+ 		temp_list = temp_list->name_next;
+ 	}
+ 
  	terminate (result, "DISK %s%s\n", state_text (result), output, details);
  }
***************
*** 370,374 ****
  				units = "TB";
  			} else {
! 				terminate (STATE_UNKNOWN, "unit type %s not known", optarg);
  			}
  			break;
--- 382,386 ----
  				units = "TB";
  			} else {
! 				terminate (STATE_UNKNOWN, "unit type %s not known\n", optarg);
  			}
  			break;
***************
*** 384,388 ****
  			show_local_fs = 1;			
  			break;
! 		case 'p':									/* selec path */
  			se = (struct name_list *) malloc (sizeof (struct name_list));
  			se->name = strdup (optarg);
--- 396,400 ----
  			show_local_fs = 1;			
  			break;
! 		case 'p':									/* select path */
  			se = (struct name_list *) malloc (sizeof (struct name_list));
  			se->name = strdup (optarg);
***************
*** 505,510 ****
  {
  	while (list) {
! 		if (! strcmp(list->name, name))
  			return TRUE;
  		list = list->name_next;
  	}
--- 517,524 ----
  {
  	while (list) {
! 		if (! strcmp(list->name, name)) {
! 			list->found = 1;
  			return TRUE;
+ 		}
  		list = list->name_next;
  	}





More information about the Commits mailing list