[Nagiosplug-devel] The scaling of the timing within the check_http plugin

Joachim Metz metz at studenten.net
Wed Nov 13 09:48:06 CET 2002


Dear reader (nagios plugin developer),

I was experimenting with Nagios and the plugins and was a bit
disappointed about the scale of the response timing of the check_http
plugins (What the plugin return on its status line.), namely seconds. I
was expecting milli seconds. Has this a certain reason ?

I have not looked at the timing of other plugins, but I was wondered if
this might change in future versions of the plugins, from seconds to
milli seconds ?

If have made some changes to the check_http.c file I had, and provided
for a scale of milli seconds. I only have adjusted the output, not the
thresholds (perhaps a nice additional change). 
It works under SuSE Linux. I do not know if it is cross platform. And I
have only tested the seperate plugin. Perhaps it is a useful feature for
future version of the plugins ?

Because I do not know if I am using the latest version of the source
(did not fetched it from CVS), therefore I send to you the entire
adjusted check_http.c file. You are free to use the changes as you like.

------------------------------------------------------------------------
Brief overview of the changes: 

added
#include <sys/timeb.h>

changed
time_t start_time, end_time;

to
struct timeb start_time_m, end_time_m;

but left in for compile issues:
time_t start_time, end_time;

added in check_http (void), but should probably be a long
int time_delta = 0;

changed several status printing rules, one of which
time_delta = ((end_time_m.time * 1000) + end_time_m.millitm) -
((start_time_m.time * 1000) + start_time_m.millitm);

msg = ssprintf (msg, ": %s - %d ms response time %s%s\n",
                                status_line, time_delta,
                                timestamp, (display_html ? "</A>" :
""));

------------------------------------------------------------------------
Regards,

Joachim Metz
<metz at studenten.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: check_http.ms.c.gz
Type: application/x-gzip
Size: 8500 bytes
Desc: not available
URL: <http://nagios-plugins.org/archive/devel/attachments/20021113/d3c9fec2/attachment.bin>


More information about the Devel mailing list