Page 1 of 1

Customize check output text

Posted: Wed Jul 15, 2015 2:11 pm
by mhixson2
Hello,

I'm sure you guys have answered this a million times, and for the life of me I can't find any good info on it. Probably incorrect search terms.

Environment:
Nagios XI 2014R2.7 installed on vanilla CentOS 6, Windows hosts using NSClient++ 0.4.3.143-x64

Question:
I'm configuring the built-in check_http command to monitor our web application for availability and response time. The command apparently lets you do all this with one check command. Here's mine:

Code: Select all

./check_http -I [web server hostname] -u http://localhost/login.aspx -4 -s "[some string]" -w 1 -c .5
Here's the return of an OK status:

Code: Select all

HTTP OK: HTTP/1.1 200 OK - 7478 bytes in 0.028 second response time |time=0.028248s;1.000000;0.500000;0.000000 size=7478B;;;0
And of a response time violation (triggered by lowering my -c option below 0.028):

Code: Select all

HTTP CRITICAL: HTTP/1.1 200 OK - 7478 bytes in 0.033 second response time |time=0.032561s;1.000000;0.010000;0.000000 size=7478B;;;0
The error response is not very informative and I'd like to modify the output to be friendlier. No one will know what the issue is if they see that output.
So... how's the done?

Thanks!

Re: Customize check output text

Posted: Wed Jul 15, 2015 3:17 pm
by jdalrymple
I'm not sure where nsclient comes into play....

The problem is that check_http is a compiled plugin. That's not necessarily an issue in and of itself as you can just modify the source and recompile. The problem is that it's an *included* compiled plugin so it could potentially get overwritten on a future upgrade, then you'd be back to recompiling and reinstalling that plugin.

That said, would you like us to put together a patch? If so how would you want the output to read differently? While I agree it's not particularly descriptive, it is complete.

Re: Customize check output text

Posted: Wed Jul 15, 2015 3:37 pm
by mhixson2
jdalrymple wrote: I'm not sure where nsclient comes into play....
Right. Not relevant here. My mistake.
jdalrymple wrote: The problem is that check_http is a compiled plugin. That's not necessarily an issue in and of itself as you can just modify the source and recompile. The problem is that it's an *included* compiled plugin so it could potentially get overwritten on a future upgrade, then you'd be back to recompiling and reinstalling that plugin.
Understood. Could it be recompiled under a different name? Like check_http_modified? Would that save it from overwrites? I don't mind having an original and a modified.
jdalrymple wrote: That said, would you like us to put together a patch? If so how would you want the output to read differently? While I agree it's not particularly descriptive, it is complete.
If we can solve for it getting overwritten, yes, that would be great.
How are the outputs defined? This check covers both response time and availability (via http content). Can OK/Warning/Critical messages be defined for response time and availability separately? Or is it a configuration for the check overall?

For documentations's sake, here's the critical output for http content when the string is not found. This one might actually not need customized.

Code: Select all

HTTP CRITICAL: HTTP/1.1 404 Not Found - string 'MRI Software' not found on 'http://[hostname]:80http://localhost/login.aspx' - 2142 bytes in 0.436 second response time |time=0.435876s;1.000000;0.010000;0.000000 size=2142B;;;0

Re: Customize check output text

Posted: Wed Jul 15, 2015 4:02 pm
by jdalrymple
mhixson2 wrote:Could it be recompiled under a different name? Like check_http_modified? Would that save it from overwrites?
Yes,yes,yes
mhixson2 wrote:How are the outputs defined?
In the source
mhixson2 wrote:Can OK/Warning/Critical messages be defined for response time and availability separately? Or is it a configuration for the check overall?
Yes,complicated.

We just need to know what you're seeking to be different to be able to suggest code modifications to you.

Re: Customize check output text

Posted: Thu Jul 16, 2015 1:50 pm
by mhixson2
Ok, how about for a string now found (critical alert), prepend the default response with "Website may be unavailable"
And for a response time violation (warning or critical), prepend the default response with "Website response time exceeded"

Edit: I'm up for suggestions. I want to keep the relevant data in the response, but it needs to be clearer so that all of our admins will know exactly what's going on.

Re: Customize check output text

Posted: Thu Jul 16, 2015 2:36 pm
by tmcdonald
I would say the "Website response time exceeded" is reasonable because that's exactly what it means. However the lack of a string does not necessarily imply that the website is unavailable.

Since this is going to end up being a code change anyway, can we move this discussion to the GitHub page?

https://github.com/nagios-plugins/nagios-plugins/

Open up an issue there titled something like "[Enhancement] Clarify plugin output on failure" and link back to this thread, providing a paragraph or so explaining what you want changed. That way the plugin maintainers can take a look and not have to ask as many questions to know exactly what you are looking for. I occasionally do work on Core and plugins, so I might be able to take a look, but if it is not in GitHub there is little chance I will remember to work on it or be able to organize my progress.