Page 1 of 1

Check_http Invalid HTTP response

Posted: Wed Jan 22, 2025 3:15 am
by whosinterestedin
Hy there,

I try to monitor an old Siemens CP 343-1 CX10. Therefore I use checkmk's check_http which, I have been told, is the quite the same as Nagios's check_mk. I try to grep for the word "established" from the HTML code below (this is the code coming out with --verbose).

Code: Select all

STATUS: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
**** HEADER ****
<html><head><title>ConnectionTable</title>
<meta http-equiv="expires" content="0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="/S7Web.css">
<SCRIPT LANGUAGE="javascript">
<!--
function SelectRow(number)
{
var h = 0;
if (typeof(window.pageYOffset) == 'number') { h = window.pageYOffset; }
else if (document.body && document.body.scrollTop) { h = document.body.scrollTop; }
else if (document.documentElement && document.documentElement.scrollTop) { h = document.documentElement.scrollTop; }
parent.location.href="/Portal6002.htm?sel=" + number + "&scroll=" + h;
}
-->
</SCRIPT>
</head>
<body onload="OnLoadDetail()">
<table summary="ConnTabShortText" class="ContentPage" cellpadding="0" cellspacing="0"><tr>
<td width="100%">
<table summary="ConnTabShortPage" class="ContentTable" cellpadding="0" cellspacing="0">
<tr><td class="ContentTableField_1">Conn. No.</td><td class="ContentTableField_1">Conn. Name</td><td class="ContentTableField_1">Partner IP address </td><td class="ContentTableField_1">Local port</td><td class="ContentTableField_1">Partner port</td><td class="ContentTableField_1">Connection State</td></tr>
<tr id="row_selected" OnClick="SelectRow('01')" OnMouseOver="this.style.cursor='pointer'"><td class="ContentTableField">1</td><td class="ContentTableField">SRM &lt;-&gt; MFC Interface</td><td class="ContentTableField">10.24.8.168</td><td class="ContentTableField">51001</td><td class="ContentTableField">30730</td><td class="ContentTableField" bgcolor="#00CC00"><noscript><a href="ConnDetail0201.htm" target="Connection_to_text"></noscript>established<noscript></a></noscript></td></tr>
<SCRIPT LANGUAGE="javascript">
<!--
function OnLoadDetail()
{
var element = document.getElementById("row_selected")
if (element)
{
element.bgColor="#BABAFD";
parent.Connection_to_text.location.href="ConnDetail0201.htm";
}
window.scrollTo(0, 0);}
-->
</SCRIPT>
<tr><td height="0" colspan="6">&nbsp;</td></tr>
</table></td></tr>
</table></body></html>
</tr></table></body></html>
**** CONTENT ****

HTTP CRITICAL - Invalid HTTP response received from host: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
Awfully check_http trows an "HTTP CRITICAL - Invalid HTTP response received from host: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">"

The check command coming out of checkmk is:

Code: Select all

./check_http -u /ConnTable02000000.htm -w 5.000000 -c 10.000000 -t 12 -l -s 'established' --sni -p 80 -I '10.10.10.10'
As first step I reduced the command to the minimalisitcs but it keeps complaining about the "Invalid response":

Code: Select all

./check_http -u /ConnTable02000000.htm -p 80 -H '10.10.10.10' -vvv
Using curl in combination with grep does not produce problems but I have to use it with "--http0.9":

Code: Select all

curl --http0.9 http://10.10.10.10/ConnTable02000000.htm | grep established
One suspicious thing I see is check_http seems to handle the returned code completely in **** HEADER **** instead of **** CONTENT **** so I have to adapt my check to search for established in the header. But first I Need to solve the "Invalid HTTP response". So I please need help because I don't know where to start searching for issues in this case.

Thanks a lot!

Re: Check_http Invalid HTTP response

Posted: Wed Jan 22, 2025 5:32 pm
by ajcoil
Hello @whosinterestedin,

Thanks for reaching out!

Unfortunately we cannot provide support for checkmk's version of check_http however you can find our source code for check_http here:
https://github.com/nagios-plugins/nagio ... eck_http.c

Along with the manual page for our version here:
https://nagios-plugins.org/doc/man/check_http.html

You might also find some success in using curl to see the full headers and output from the device.
ex) curl -ik https://10.10.10.10


If you have any other questions, comments, or concerns, feel free to reach out!