Nagios plugins v1.3.1 - PS_RAW_COMMAND not defined on HP-UX

C. Bensend benny at bennyvision.com
Thu Jul 17 18:20:25 CEST 2003


Hey folks,

	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 at 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 (nagios at bennyvision.com) */
> 
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;
<       }
---
> //    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);
<       }
---
> //    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++;
<       }
---
> //    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);
---
> //    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);
---
> //    /* close stderr */
> //    (void) fclose (child_stderr);
110,111c115,116
<       if (spclose (child_process))
<               result = max_state (result, STATE_WARNING);
---
> //    if (spclose (child_process))
> //            result = max_state (result, STATE_WARNING);
114c119
<       alarm (0);
---
> //    alarm (0);
116,119c121,124
<       if (proc_entries == 0) {
<               printf ("Could not locate a running Nagios process!\n");
<               return STATE_CRITICAL;
<       }
---
> //    if (proc_entries == 0) {
> //            printf ("Could not locate a running Nagios process!\n");
> //            return STATE_CRITICAL;
> //    }
121c126
<       result = STATE_OK;
---
> //    result = STATE_OK;
128c133
<               ("Nagios %s: located %d process%s, status log updated %d second%s ago\n",
---
>               ("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 Duncan, USMC Ret.


-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0




More information about the Developers mailing list