check_http warning for 404 Not Found

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
vy3734
Posts: 109
Joined: Tue Sep 29, 2015 4:48 pm

check_http warning for 404 Not Found

Post by vy3734 »

t@ma209dlvmon libexec]# ./check_http -H ma209blvnav -p 8080
HTTP WARNING: HTTP/1.1 404 Not Found - 167 bytes in 0.003 second response time |time=0.003447s;;;0.000000 size=167B;;;

Why status is WARNING for 404 Not Found? Can status be changed to critical?
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: check_http warning for 404 Not Found

Post by mcapra »

You might alter your command definition to leverage the -e argument:

Code: Select all

 -e, --expect=STRING
    Comma-delimited list of strings, at least one of them is expected in
    the first (status) line of the server response (default: HTTP/1.)
    If specified skips all other status line logic (ex: 3xx, 4xx, 5xx processing)
In practice:

Code: Select all

[root@localhost libexec]# ./check_http -H www.google.com -u "/test.html" -p 80
HTTP WARNING: HTTP/1.1 404 Not Found - 1714 bytes in 0.098 second response time |time=0.098465s;;;0.000000 size=1714B;;;0
Warnings are no good! When we instead leverage the -e argument to say the page's response code must be 200:

Code: Select all

[root@localhost libexec]# ./check_http -H www.google.com -u "/test.html" -p 80 -e "200"
HTTP CRITICAL - Invalid HTTP response received from host: HTTP/1.1 404 Not Found
Former Nagios employee
https://www.mcapra.com/
vy3734
Posts: 109
Joined: Tue Sep 29, 2015 4:48 pm

Re: check_http warning for 404 Not Found

Post by vy3734 »

thanks, this working fine.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: check_http warning for 404 Not Found

Post by rkennedy »

Are we good to mark this thread as resolved?
Former Nagios Employee
Locked