Tomcat – Nagios check_http – checking tomcat application status with regex & linespan

nagiosregextomcat

I wan't to check with our Nagios if a webapplication is running on Tomca7. I decided to use the check_http plugin with regex. I'm parsing the status-page of tomcat and check if column "Running" is true. The Sourcecode of the status-page looks like this (snipped):

<td class="row-left" bgcolor="#FFFFFF" rowspan="2"><small>Applicationname</small></td>
<td class="row-center" bgcolor="#FFFFFF" rowspan="2"><small>true</small></td>

The 2 informations are in 2 different lines.
So my line to check is the folowing:

./check_http -I 111.111.111.111 -p 8080 -a user:password -u /manager/html -rl 'Applicationname</small></td>\n.<td class="row-center" bgcolor="#FFFFFF" rowspan="2"><small>true'

The problem is, that the response of the plugin is always true ("HTTP OK") when I'm using the parameter "-l". Also when I modify the search-string like this to force a critical:

./check_http -I 111.111.111.111 -p 8080 -a user:password -u /manager/html -rl 'Applicationname</small></td>\n.<td class="row-center" bgcolor="#FFFFFF" rowspan="2"><small>fail_true'

I have no idea why this happaned. Someone any idea? Thanks, Arny

Best Answer

Why not use the /manager/text/list to see the plain text manager interface instead of the HTML interface:

./check_http -I 111.111.111.111 -p 8080 -a user:password -u /manager/text/list -s 'Applicationname:running'

HTTP OK: HTTP/1.1 200 OK - 510 bytes in 0.003 second response time |time=0.003004s;;;0.000000 size=510B;;;0