Search
j0ke.net Open Build Service
>
Projects
>
home:netmax
>
nagios-plugins
> nagios-plugins_DISABLE-SMARTENABLE.patch
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File nagios-plugins_DISABLE-SMARTENABLE.patch of Package nagios-plugins
--- plugins/check_ide_smart.c.orig 2013-11-24 11:30:58.436360581 +0100 +++ plugins/check_ide_smart.c 2013-11-24 12:46:26.826827505 +0100 @@ -180,6 +180,7 @@ int command = -1; int o, longindex; int retval = 0; + int smartenable = 1; thresholds_t thresholds; values_t values; @@ -192,6 +193,7 @@ {"auto-on", no_argument, 0, '1'}, {"auto-off", no_argument, 0, '0'}, {"nagios", no_argument, 0, 'n'}, + {"disable_smartenable", no_argument, 0, 'N'}, {"help", no_argument, 0, 'h'}, {"version", no_argument, 0, 'V'}, {0, 0, 0, 0} @@ -206,7 +208,7 @@ while (1) { - o = getopt_long (argc, argv, "+d:iq10nhV", longopts, &longindex); + o = getopt_long (argc, argv, "+d:iq10nNhV", longopts, &longindex); if (o == -1 || o == EOF || o == 1) break; @@ -230,6 +232,9 @@ case 'n': command = 4; break; + case 'N': + smartenable = 0; + break; case 'h': print_help (); return STATE_OK; @@ -256,10 +261,11 @@ printf (_("CRITICAL - Couldn't open device %s: %s\n"), device, strerror (errno)); return STATE_CRITICAL; } - - if (smart_cmd_simple (fd, SMART_CMD_ENABLE, 0, TRUE)) { - printf (_("CRITICAL - SMART_CMD_ENABLE\n")); - return STATE_CRITICAL; + if ( smartenable == 1 ) { + if (smart_cmd_simple (fd, SMART_CMD_ENABLE, 0, TRUE)) { + printf (_("CRITICAL - SMART_CMD_ENABLE\n")); + return STATE_CRITICAL; + } } switch (command) { @@ -618,6 +624,8 @@ printf (" %s\n", _("Turn off automatic offline tests")); printf (" %s\n", "-n, --nagios"); printf (" %s\n", _("Output suitable for Nagios")); + printf (" %s\n", "-N, --disable_smartenable"); + printf (" %s\n", _("Disable SMART_ENABLE command on startup")); printf (UT_SUPPORT); } @@ -639,5 +647,5 @@ { printf ("%s\n", _("Usage:")); printf ("%s [-d <device>] [-i <immediate>] [-q quiet] [-1 <auto-on>]",progname); - printf (" [-O <auto-off>] [-n <nagios>]\n"); + printf (" [-O <auto-off>] [-n <nagios>] [-N <disable_smartenable>]\n"); }