summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_ide_smart.c55
1 files changed, 20 insertions, 35 deletions
diff --git a/plugins/check_ide_smart.c b/plugins/check_ide_smart.c
index c348cb7a..4eea72c4 100644
--- a/plugins/check_ide_smart.c
+++ b/plugins/check_ide_smart.c
@@ -178,7 +178,6 @@ int
178main (int argc, char *argv[]) 178main (int argc, char *argv[])
179{ 179{
180 char *device = NULL; 180 char *device = NULL;
181 int command = -1;
182 int o, longindex; 181 int o, longindex;
183 int retval = 0; 182 int retval = 0;
184 183
@@ -221,13 +220,10 @@ main (int argc, char *argv[])
221 fprintf (stderr, "%s\n", _("Nagios-compatible output is now always returned.")); 220 fprintf (stderr, "%s\n", _("Nagios-compatible output is now always returned."));
222 break; 221 break;
223 case 'i': 222 case 'i':
224 command = 2;
225 break;
226 case '1': 223 case '1':
227 command = 1;
228 break;
229 case '0': 224 case '0':
230 command = 0; 225 printf ("%s\n", _("SMART commands are broken and have been disabled (See Notes in --help)."));
226 return STATE_CRITICAL;
231 break; 227 break;
232 case 'n': 228 case 'n':
233 fprintf (stderr, "%s\n", _("DEPRECATION WARNING: the -n switch (Nagios-compatible output) is now the")); 229 fprintf (stderr, "%s\n", _("DEPRECATION WARNING: the -n switch (Nagios-compatible output) is now the"));
@@ -268,23 +264,11 @@ main (int argc, char *argv[])
268 return STATE_CRITICAL; 264 return STATE_CRITICAL;
269 } 265 }
270 266
271 switch (command) { 267 smart_read_values (fd, &values);
272 case 0: 268 smart_read_thresholds (fd, &thresholds);
273 retval = smart_cmd_simple (fd, SMART_CMD_AUTO_OFFLINE, 0, TRUE); 269 retval = nagios (&values, &thresholds);
274 break; 270 if (verbose) print_values (&values, &thresholds);
275 case 1: 271
276 retval = smart_cmd_simple (fd, SMART_CMD_AUTO_OFFLINE, 0xF8, TRUE);
277 break;
278 case 2:
279 retval = smart_cmd_simple (fd, SMART_CMD_IMMEDIATE_OFFLINE, 0, TRUE);
280 break;
281 default:
282 smart_read_values (fd, &values);
283 smart_read_thresholds (fd, &thresholds);
284 retval = nagios (&values, &thresholds);
285 if (verbose) print_values (&values, &thresholds);
286 break;
287 }
288 close (fd); 272 close (fd);
289 return retval; 273 return retval;
290} 274}
@@ -614,16 +598,18 @@ print_help (void)
614 printf (" %s\n", "-d, --device=DEVICE"); 598 printf (" %s\n", "-d, --device=DEVICE");
615 printf (" %s\n", _("Select device DEVICE")); 599 printf (" %s\n", _("Select device DEVICE"));
616 printf (" %s\n", _("Note: if the device is selected with this option, _no_ other options are accepted")); 600 printf (" %s\n", _("Note: if the device is selected with this option, _no_ other options are accepted"));
617 printf (" %s\n", "-i, --immediate"); 601
618 printf (" %s\n", _("Perform immediately offline tests")); 602 printf (UT_VERBOSE);
619 printf (" %s\n", "-q, --quiet-check"); 603
620 printf (" %s\n", _("Returns the number of failed tests")); 604 printf ("\n");
621 printf (" %s\n", "-1, --auto-on"); 605 printf ("%s\n", _("Notes:"));
622 printf (" %s\n", _("Turn on automatic offline tests")); 606 printf (" %s\n", _("The SMART command modes (-i/--immediate, -0/--auto-off and -1/--auto-on) were"));
623 printf (" %s\n", "-0, --auto-off"); 607 printf (" %s\n", _("broken in an underhand manner and have been disabled. You can use smartctl"));
624 printf (" %s\n", _("Turn off automatic offline tests")); 608 printf (" %s\n", _("instead:"));
625 609 printf (" %s\n", _("-0/--auto-off: use \"smartctl --offlineauto=off\""));
626 printf (UT_VERBOSE); 610 printf (" %s\n", _("-1/--auto-on: use \"smartctl --offlineauto=on\""));
611 printf (" %s\n", _("-i/--immediate: use \"smartctl --test=offline\""));
612
627 printf (UT_SUPPORT); 613 printf (UT_SUPPORT);
628} 614}
629 615
@@ -643,6 +629,5 @@ void
643print_usage (void) 629print_usage (void)
644{ 630{
645 printf ("%s\n", _("Usage:")); 631 printf ("%s\n", _("Usage:"));
646 printf ("%s [-d <device>] [-i <immediate>] [-q quiet] [-1 <auto-on>]", progname); 632 printf ("%s [-d <device>] [-v]", progname);
647 printf (" [-O <auto-off>] [-v]\n");
648} 633}