[Nagiosplug-help] check_http -m and binary (gif, in particular) responses

jon gold dev at samizdatdigital.org
Thu Dec 30 18:35:02 CET 2004

pardon me if i've overlooked any previous discussion about this, but i 
couldn't find any in the sourceforge archives.

has anyone used check_http and -m to check that an image being returned 
from a url is of an expected size? i tried -m with the number of bytes 
i'm expecting, but the check fails. using -v from the shell, i can see 
that in fact the Content-Type is gif, and the Content-Length is what i 
expect for the byte count, but i can't find a way to use check_http to 
get at or confirm that fact. the -s option seems to only work for the 
body, and the -e only gets the first line.

looking at check_http.c, it seems that the length check is done with strlen:

     if ((min_page_len > 0) && (page_len < min_page_len))

but since my page is a gif, and since strlen only goes up to the first 
(and presumably string-terminating) 0, i assume i'm getting incorrect 
results due to the fact that 0 is valid in the middle of a gif. i'll try 
and build http.c for myself and make some changes to confirm this, but 
it seems like a likely cause.

is there any reason not to use the value of pagesize which is computed 
during the page retrieval instead of strlen? if there is, could we think 
of adding a new switch, maybe something like --min-binary-length which 
would not do a strlen check, but a pagesize one?


More information about the Help mailing list