I got an email from someone today asking for an HP-UX 11.x binary
of check_nagios. So, I ssh'ed over to one of my development machines, and
figured it would be a quick build.
Well, it turns out that PS_RAW_COMMAND doesn't get defined, at
least not on HP-UX 11.00. I compared the 'ps' arguments between one of
my OpenBSD machines and HP-UX, and could not find comparible arguments.
So, I hacked into check_nagios.c as follows:
benny@ninja 34: diff plugins/check_nagios.c.orig plugins/check_nagios.c
83a84,88
> /* IGNORE THE PROCESS TEST - this thing is broken on HP-UX, as
> PS_RAW_COMMAND never gets defined. I looked through the man
> page for 'ps', and could not find an equivalent set of options
> to patch configure.in with. - Benny, 7-2003 ([email protected]) */
>
85,89c90,94
// child_process = spopen (PS_RAW_COMMAND);
> // if (child_process == NULL) {
> // printf ("Could not open pipe: %s\n", PS_RAW_COMMAND);
> // return STATE_UNKNOWN;
> // }
91,94c96,99
// child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");> // if (child_stderr == NULL) {
> // printf ("Could not open stderr for %s\n", PS_RAW_COMMAND);
> // }
97,100c102,105
// while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) {
> // if (!strstr(input_buffer, argv[0]) && strstr(input_buffer, process_string))
> // proc_entries++;
> // }
103,104c108,109
// while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr))
> // result = max_state (result, STATE_WARNING);
106,107c111,112
// /* close stderr */
> // (void) fclose (child_stderr);
110,111c115,116
// if (spclose (child_process))
> // result = max_state (result, STATE_WARNING);
114c119
// alarm (0);
116,119c121,124
// if (proc_entries == 0) {
> // printf ("Could not locate a running Nagios process!\n");
> // return STATE_CRITICAL;
> // }
121c126
// result = STATE_OK;
128c133
("Nagios %s: not checking processes, status log updated %d second%s ago\n",
Yes, I know this disables the process checking... I thought, for
a quick fix, that's a reasonable sacrifice. However, the much much better
solution would be to get a working PS_RAW_COMMAND on HP-UX. And yes, I
know that's probably about the ugliest patch you've ever seen - it was a
five minute fix.
Hell, I don't even know if it works correctly, although I don't
see any reason it shouldn't. If someone (Ethan?) would like to work on
the PS_RAW_COMMAND thing, I can try to help if needed.
Thanks!
Benny
--
"Corpsman: usually a young, long-haired, bearded, Marine hatin' Sailor
with certain medical skills, who will go through the very gates of hell to
get to a wounded Marine." - Major Gene
...[email truncated]...
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]