|
@@ -70,6 +70,7 @@ main (int argc, char **argv)
|
|
|
char *p, *ret[QSTAT_MAX_RETURN_ARGS];
|
|
char *p, *ret[QSTAT_MAX_RETURN_ARGS];
|
|
|
size_t i = 0;
|
|
size_t i = 0;
|
|
|
output chld_out;
|
|
output chld_out;
|
|
|
|
|
+ output chld_err;
|
|
|
|
|
|
|
|
setlocale (LC_ALL, "");
|
|
setlocale (LC_ALL, "");
|
|
|
bindtextdomain (PACKAGE, LOCALEDIR);
|
|
bindtextdomain (PACKAGE, LOCALEDIR);
|
|
@@ -95,7 +96,7 @@ main (int argc, char **argv)
|
|
|
|
|
|
|
|
/* run the command. historically, this plugin ignores output on stderr,
|
|
/* run the command. historically, this plugin ignores output on stderr,
|
|
|
* as well as return status of the qstat program */
|
|
* as well as return status of the qstat program */
|
|
|
- (void)np_runcmd(command_line, &chld_out, NULL, 0);
|
|
|
|
|
|
|
+ (void)np_runcmd(command_line, &chld_out, &chld_err, 0);
|
|
|
|
|
|
|
|
/* sanity check */
|
|
/* sanity check */
|
|
|
/* was thinking about running qstat without any options, capturing the
|
|
/* was thinking about running qstat without any options, capturing the
|
|
@@ -107,11 +108,16 @@ main (int argc, char **argv)
|
|
|
In the end, I figured I'd simply let an error occur & then trap it
|
|
In the end, I figured I'd simply let an error occur & then trap it
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
- if (!strncmp (chld_out.line[0], "unknown option", 14)) {
|
|
|
|
|
|
|
+ if (chld_err.line != NULL && !strncmp (chld_err.line[0], "unknown option", 14)) {
|
|
|
printf (_("CRITICAL - Host type parameter incorrect!\n"));
|
|
printf (_("CRITICAL - Host type parameter incorrect!\n"));
|
|
|
result = STATE_CRITICAL;
|
|
result = STATE_CRITICAL;
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
+ else if (chld_out.line == NULL) {
|
|
|
|
|
+ printf (_("CRITICAL - Error when running qstat!\n"));
|
|
|
|
|
+ result = STATE_CRITICAL;
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
p = (char *) strtok (chld_out.line[0], QSTAT_DATA_DELIMITER);
|
|
p = (char *) strtok (chld_out.line[0], QSTAT_DATA_DELIMITER);
|
|
|
while (p != NULL) {
|
|
while (p != NULL) {
|