We have several server racks that are monitored by nagios. Now we want to monitor temperature inside the racks by a Nagios installation outside the racks. The temperature inside the server racks ist measured by servers running in the rack which deliver temperature over http. A request http://serverinrack12/temp
delivers one of the four "Nagios compatible" command messages:
OK - temp 25 °C
WARNING - temp 45 °C
CRITICAL - temp 65 °C
UNKNOWN - cannot read temp
The HTTP response code is always HTTP/1.1 200 OK
.
How can this http response be parsed by Nagios if nothing can be changed on the server?
Is there a Nagios command to read service states by http? How can this Nagios command be integrated in a command definition, e.g. as
define command {
command_name check_http_temp
command_line .... -H $HOSTADDRESS$
}
Ideally there is a command to call this temp-checks by adding an id to support several thermometers attached to this server:
http://serverinrack12/temp?id=1
Last question: How can we get temperature performance data with Nagios over http?
Best Answer
You need to either write a plugin, or find one that will parse the content of a webpage. Nagios doesn't care at all what the string returned is (as that is for human consumption). Nagios only cares about the exit code (AKA return value).
You can do this without installing anything on the servers. You could, for example, write a bash script that fetches the
/temp
content via curl and then does some string matching. Sub "bash" for your scripting language of choice.The stock
check_http
plugin can look for a certain string, but it cannot return different status values for different strings, as far as I can see.If you don't want to write something, dig around Nagios Exchange and/or Monitoring Exchange.