summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTon Voon <tonvoon@users.sourceforge.net>2003-06-25 13:28:05 (GMT)
committerTon Voon <tonvoon@users.sourceforge.net>2003-06-25 13:28:05 (GMT)
commitdeeb29c7ded32f6af3c5fbadba7fe04cddfc0b8f (patch)
treea20bb5a563228894fa374fdc072e3a0bfb4a5e18
parentce952504d15a2bafa8a1aabb7f5fb1507cad2f84 (diff)
downloadmonitoring-plugins-deeb29c7ded32f6af3c5fbadba7fe04cddfc0b8f.tar.gz
Report errors if path specified not found
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@555 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r--plugins/check_disk.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/plugins/check_disk.c b/plugins/check_disk.c
index 62858b5..585c4a6 100644
--- a/plugins/check_disk.c
+++ b/plugins/check_disk.c
@@ -106,6 +106,7 @@ static int require_sync = 0;
106struct name_list 106struct name_list
107{ 107{
108 char *name; 108 char *name;
109 int found;
109 struct name_list *name_next; 110 struct name_list *name_next;
110}; 111};
111 112
@@ -190,6 +191,7 @@ main (int argc, char **argv)
190 191
191 struct mount_entry *me; 192 struct mount_entry *me;
192 struct fs_usage fsp; 193 struct fs_usage fsp;
194 struct name_list *temp_list;
193 char *disk; 195 char *disk;
194 196
195 mount_list = read_filesystem_list (0); 197 mount_list = read_filesystem_list (0);
@@ -252,6 +254,16 @@ main (int argc, char **argv)
252 if (verbose > 2) 254 if (verbose > 2)
253 asprintf (&output, "%s%s", output, details); 255 asprintf (&output, "%s%s", output, details);
254 256
257 /* Override result if paths specified and not found */
258 temp_list = path_select_list;
259 while (temp_list) {
260 if (temp_list->found != TRUE) {
261 asprintf (&output, "%s [%s not found]", output, temp_list->name);
262 result = STATE_CRITICAL;
263 }
264 temp_list = temp_list->name_next;
265 }
266
255 terminate (result, "DISK %s%s\n", state_text (result), output, details); 267 terminate (result, "DISK %s%s\n", state_text (result), output, details);
256} 268}
257 269
@@ -369,7 +381,7 @@ process_arguments (int argc, char **argv)
369 mult = (unsigned long)1024 * 1024 * 1024 * 1024; 381 mult = (unsigned long)1024 * 1024 * 1024 * 1024;
370 units = "TB"; 382 units = "TB";
371 } else { 383 } else {
372 terminate (STATE_UNKNOWN, "unit type %s not known", optarg); 384 terminate (STATE_UNKNOWN, "unit type %s not known\n", optarg);
373 } 385 }
374 break; 386 break;
375 case 'k': /* display mountpoint */ 387 case 'k': /* display mountpoint */
@@ -383,7 +395,7 @@ process_arguments (int argc, char **argv)
383 case 'l': 395 case 'l':
384 show_local_fs = 1; 396 show_local_fs = 1;
385 break; 397 break;
386 case 'p': /* selec path */ 398 case 'p': /* select path */
387 se = (struct name_list *) malloc (sizeof (struct name_list)); 399 se = (struct name_list *) malloc (sizeof (struct name_list));
388 se->name = strdup (optarg); 400 se->name = strdup (optarg);
389 se->name_next = NULL; 401 se->name_next = NULL;
@@ -504,8 +516,10 @@ int
504walk_name_list (struct name_list *list, const char *name) 516walk_name_list (struct name_list *list, const char *name)
505{ 517{
506 while (list) { 518 while (list) {
507 if (! strcmp(list->name, name)) 519 if (! strcmp(list->name, name)) {
520 list->found = 1;
508 return TRUE; 521 return TRUE;
522 }
509 list = list->name_next; 523 list = list->name_next;
510 } 524 }
511 return FALSE; 525 return FALSE;