|
@@ -80,6 +80,7 @@ int check_crit = FALSE;
|
|
|
int check_variable = UPS_NONE;
|
|
int check_variable = UPS_NONE;
|
|
|
int supported_options = UPS_NONE;
|
|
int supported_options = UPS_NONE;
|
|
|
int status = UPSSTATUS_NONE;
|
|
int status = UPSSTATUS_NONE;
|
|
|
|
|
+static int extended_units = 0;
|
|
|
|
|
|
|
|
double ups_utility_voltage = 0.0;
|
|
double ups_utility_voltage = 0.0;
|
|
|
double ups_battery_percent = 0.0;
|
|
double ups_battery_percent = 0.0;
|
|
@@ -212,13 +213,13 @@ main (int argc, char **argv)
|
|
|
result = max_state (result, STATE_WARNING);
|
|
result = max_state (result, STATE_WARNING);
|
|
|
}
|
|
}
|
|
|
xasprintf (&data, "%s",
|
|
xasprintf (&data, "%s",
|
|
|
- fperfdata ("voltage", ups_utility_voltage, "",
|
|
|
|
|
|
|
+ fperfdata ("voltage", ups_utility_voltage, (extended_units ? "V" : ""),
|
|
|
check_warn, warning_value,
|
|
check_warn, warning_value,
|
|
|
check_crit, critical_value,
|
|
check_crit, critical_value,
|
|
|
TRUE, 0, FALSE, 0));
|
|
TRUE, 0, FALSE, 0));
|
|
|
} else {
|
|
} else {
|
|
|
xasprintf (&data, "%s",
|
|
xasprintf (&data, "%s",
|
|
|
- fperfdata ("voltage", ups_utility_voltage, "",
|
|
|
|
|
|
|
+ fperfdata ("voltage", ups_utility_voltage, (extended_units ? "V" : ""),
|
|
|
FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0));
|
|
FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -307,13 +308,13 @@ main (int argc, char **argv)
|
|
|
result = max_state (result, STATE_WARNING);
|
|
result = max_state (result, STATE_WARNING);
|
|
|
}
|
|
}
|
|
|
xasprintf (&data, "%s %s", data,
|
|
xasprintf (&data, "%s %s", data,
|
|
|
- fperfdata ("temp", ups_temperature, "",
|
|
|
|
|
|
|
+ fperfdata ("temp", ups_temperature, (extended_units ? tunits : ""),
|
|
|
check_warn, warning_value,
|
|
check_warn, warning_value,
|
|
|
check_crit, critical_value,
|
|
check_crit, critical_value,
|
|
|
TRUE, 0, FALSE, 0));
|
|
TRUE, 0, FALSE, 0));
|
|
|
} else {
|
|
} else {
|
|
|
xasprintf (&data, "%s %s", data,
|
|
xasprintf (&data, "%s %s", data,
|
|
|
- fperfdata ("temp", ups_temperature, "",
|
|
|
|
|
|
|
+ fperfdata ("temp", ups_temperature, (extended_units ? tunits : ""),
|
|
|
FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0));
|
|
FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -466,6 +467,7 @@ process_arguments (int argc, char **argv)
|
|
|
{"port", required_argument, 0, 'p'},
|
|
{"port", required_argument, 0, 'p'},
|
|
|
{"critical", required_argument, 0, 'c'},
|
|
{"critical", required_argument, 0, 'c'},
|
|
|
{"warning", required_argument, 0, 'w'},
|
|
{"warning", required_argument, 0, 'w'},
|
|
|
|
|
+ {"extended-units", no_argument, 0, 'e'},
|
|
|
{"timeout", required_argument, 0, 't'},
|
|
{"timeout", required_argument, 0, 't'},
|
|
|
{"temperature", no_argument, 0, 'T'},
|
|
{"temperature", no_argument, 0, 'T'},
|
|
|
{"variable", required_argument, 0, 'v'},
|
|
{"variable", required_argument, 0, 'v'},
|
|
@@ -536,6 +538,9 @@ process_arguments (int argc, char **argv)
|
|
|
usage2 (_("Warning time must be a positive integer"), optarg);
|
|
usage2 (_("Warning time must be a positive integer"), optarg);
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
|
|
+ case 'e':
|
|
|
|
|
+ extended_units = 1;
|
|
|
|
|
+ break;
|
|
|
case 'v': /* variable */
|
|
case 'v': /* variable */
|
|
|
if (!strcmp (optarg, "LINE"))
|
|
if (!strcmp (optarg, "LINE"))
|
|
|
check_variable = UPS_UTILITY;
|
|
check_variable = UPS_UTILITY;
|
|
@@ -615,6 +620,8 @@ print_help (void)
|
|
|
printf (" %s\n", _("Name of UPS"));
|
|
printf (" %s\n", _("Name of UPS"));
|
|
|
printf (" %s\n", "-T, --temperature");
|
|
printf (" %s\n", "-T, --temperature");
|
|
|
printf (" %s\n", _("Output of temperatures in Celsius"));
|
|
printf (" %s\n", _("Output of temperatures in Celsius"));
|
|
|
|
|
+ printf (" %s\n", "-e, --extended-units");
|
|
|
|
|
+ printf (" %s\n", _("Allow nonstandard units in performance data (used for voltage an temperatures)."));
|
|
|
printf (" %s\n", "-v, --variable=STRING");
|
|
printf (" %s\n", "-v, --variable=STRING");
|
|
|
printf (" %s %s\n", _("Valid values for STRING are"), "LINE, TEMP, BATTPCT or LOADPCT");
|
|
printf (" %s %s\n", _("Valid values for STRING are"), "LINE, TEMP, BATTPCT or LOADPCT");
|
|
|
|
|
|
|
@@ -653,5 +660,5 @@ void
|
|
|
print_usage (void)
|
|
print_usage (void)
|
|
|
{
|
|
{
|
|
|
printf ("%s\n", _("Usage:"));
|
|
printf ("%s\n", _("Usage:"));
|
|
|
- printf ("%s -H host -u ups [-p port] [-v variable] [-w warn_value] [-c crit_value] [-to to_sec] [-T]\n", progname);
|
|
|
|
|
|
|
+ printf ("%s -H host -u ups [-p port] [-v variable] [-w warn_value] [-c crit_value] [-e] [-to to_sec] [-T]\n", progname);
|
|
|
}
|
|
}
|