Bläddra i källkod

Issue #422: Added support for binary units (KiB, MiB, GiB, TiB) for check_disk plugin (incl update of french and german translation)

rogerniesten 7 år sedan
förälder
incheckning
52d3bdc647
4 ändrade filer med 17 tillägg och 5 borttagningar
  1. 13 1
      plugins/check_disk.c
  2. 1 1
      po/de.po
  3. 2 2
      po/fr.po
  4. 1 1
      po/nagios-plugins.pot

+ 13 - 1
plugins/check_disk.c

@@ -581,6 +581,18 @@ process_arguments (int argc, char **argv)
       } else if (! strcmp (optarg, "TB")) {
         mult = (uintmax_t)1024 * 1024 * 1024 * 1024;
         units = strdup ("TB");
+      } else if (! strcmp (optarg, "KiB")) {
+        mult = (uintmax_t)1000;
+        units = strdup ("KiB");
+      } else if (! strcmp (optarg, "MiB")) {
+        mult = (uintmax_t)1000 * 1000;
+        units = strdup ("MiB");
+      } else if (! strcmp (optarg, "GiB")) {
+        mult = (uintmax_t)1000 * 1000 * 1000;
+        units = strdup ("GiB");
+      } else if (! strcmp (optarg, "TiB")) {
+        mult = (uintmax_t)1000 * 1000 * 1000 * 1000;
+        units = strdup ("TiB");
       } else {
         die (STATE_UNKNOWN, _("unit type %s not known\n"), optarg);
       }
@@ -951,7 +963,7 @@ print_help (void)
   printf ("    %s\n", _("Regular expression to ignore selected path or partition (may be repeated)"));
   printf (UT_PLUG_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
   printf (" %s\n", "-u, --units=STRING");
-  printf ("    %s\n", _("Choose bytes, kB, MB, GB, TB (default: MB)"));
+  printf ("    %s\n", _("Choose bytes, kB, MB, GB, TB, KiB, MiB, GiB, TiB (default: MB)"));
   printf (UT_VERBOSE);
   printf (" %s\n", "-X, --exclude-type=TYPE");
   printf ("    %s\n", _("Ignore all filesystems of indicated type (may be repeated)"));

+ 1 - 1
po/de.po

@@ -566,7 +566,7 @@ msgid ""
 msgstr ""
 
 #: plugins/check_disk.c:957
-msgid "Choose bytes, kB, MB, GB, TB (default: MB)"
+msgid "Choose bytes, kB, MB, GB, TB, KiB, MiB, GiB, TiB (default: MB)"
 msgstr ""
 
 #: plugins/check_disk.c:960

+ 2 - 2
po/fr.po

@@ -577,8 +577,8 @@ msgstr ""
 "être utilisé plusieurs fois)"
 
 #: plugins/check_disk.c:957
-msgid "Choose bytes, kB, MB, GB, TB (default: MB)"
-msgstr "Choisissez octets, kb, MB, GB, TB (par défaut: MB)"
+msgid "Choose bytes, kB, MB, GB, TB, KiB, MiB, GiB, TiB (default: MB)"
+msgstr "Choisissez octets, kb, MB, GB, TB, KiB, MiB, GiB, TiB (par défaut: MB)"
 
 #: plugins/check_disk.c:960
 msgid "Ignore all filesystems of indicated type (may be repeated)"

+ 1 - 1
po/nagios-plugins.pot

@@ -545,7 +545,7 @@ msgid ""
 msgstr ""
 
 #: plugins/check_disk.c:899
-msgid "Choose bytes, kB, MB, GB, TB (default: MB)"
+msgid "Choose bytes, kB, MB, GB, TB, KiB, MiB, GiB, TiB (default: MB)"
 msgstr ""
 
 #: plugins/check_disk.c:902