Nagios Core unreachable website checks

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
User avatar
t3dus
Posts: 161
Joined: Thu Feb 04, 2016 3:46 pm
Location: IA
Contact:

Nagios Core unreachable website checks

Post by t3dus »

Fresh install of Nagios core on a new server and it can't reach any websites for ping or check_http checks

I'm not sure why because I can ping these websites from within the server itself so the server can reach these sites but nagios core claims every website i have configured is unreachable..

How can I resolve this?
Attachments
nagios unreachable.PNG
User avatar
t3dus
Posts: 161
Joined: Thu Feb 04, 2016 3:46 pm
Location: IA
Contact:

Re: Nagios Core unreachable website checks

Post by t3dus »

If i go into /var/log/apache2/error.log

I see a bunch of errors like this

[Tue Feb 22 15:39:01.535520 2022] [php7:notice] [pid 790] [client IP ADDRESS HIDDEN] PHP Notice: Trying to access array offset on value of type bool in /usr/local/nagios/share/includes/utils.inc.php on line 154,
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Nagios Core unreachable website checks

Post by gormank »

I'd try running the check_ping command from the shell as defined in the command and see what happens. If check_http fails you might try check_icmp.
You may also post the service and command definitions for http and ping as well.
User avatar
t3dus
Posts: 161
Joined: Thu Feb 04, 2016 3:46 pm
Location: IA
Contact:

Re: Nagios Core unreachable website checks

Post by t3dus »

gormank wrote:I'd try running the check_ping command from the shell as defined in the command and see what happens. If check_http fails you might try check_icmp.
You may also post the service and command definitions for http and ping as well.
I was trying to figure out the command for that and where to run it from but I don't think I have the correct commands.
User avatar
t3dus
Posts: 161
Joined: Thu Feb 04, 2016 3:46 pm
Location: IA
Contact:

Re: Nagios Core unreachable website checks

Post by t3dus »

gormank wrote:I'd try running the check_ping command from the shell as defined in the command and see what happens. If check_http fails you might try check_icmp.
You may also post the service and command definitions for http and ping as well.
Figured out the command. Apparently it works for google.com but not my own websites though it works fine on my second nagios server..
Attachments
nagios check.PNG
nagios check.PNG (7.71 KiB) Viewed 2049 times
User avatar
t3dus
Posts: 161
Joined: Thu Feb 04, 2016 3:46 pm
Location: IA
Contact:

Re: Nagios Core unreachable website checks

Post by t3dus »

This is still an unsolved issue that I'd like some support with. Thank you
atc0005
Posts: 26
Joined: Thu Oct 28, 2021 2:03 pm

Re: Nagios Core unreachable website checks

Post by atc0005 »

One approach that has worked well for me in the past when troubleshooting service checks is to run them as the same user account that executes the plugin and also run the commands with the same arguments as the Nagios instance.

1) Login to Nagios Core system/console
2) sudo --login --user nagios
3) /usr/local/nagios/libexec/check_http -H snapgeek.com
4) ping snapgeek.com
5) nmap -sT -p 80,443 snapgeek.com
6) nmap -sT -Pn -p 80,443 snapgeek.com


The last command disables using ping to determine if the host is up before attempting to connect to the ports. If you don't have nmap installed it's worth installing on the Nagios box for this and future troubleshooting tasks.

Based on what you've noted, it may be that 80/tcp (non-https) is the default for check_http and you don't have that port exposed to Nagios.
User avatar
t3dus
Posts: 161
Joined: Thu Feb 04, 2016 3:46 pm
Location: IA
Contact:

Re: Nagios Core unreachable website checks

Post by t3dus »

atc0005 wrote:One approach that has worked well for me in the past when troubleshooting service checks is to run them as the same user account that executes the plugin and also run the commands with the same arguments as the Nagios instance.

1) Login to Nagios Core system/console
2) sudo --login --user nagios
3) /usr/local/nagios/libexec/check_http -H snapgeek.com
4) ping snapgeek.com
5) nmap -sT -p 80,443 snapgeek.com
6) nmap -sT -Pn -p 80,443 snapgeek.com


The last command disables using ping to determine if the host is up before attempting to connect to the ports. If you don't have nmap installed it's worth installing on the Nagios box for this and future troubleshooting tasks.

Based on what you've noted, it may be that 80/tcp (non-https) is the default for check_http and you don't have that port exposed to Nagios.
When I run the commands below it fails on snapgeek.com but works on google.com

Code: Select all

$ /usr/local/nagios/libexec/check_http -H snapgeek.com
CRITICAL - Socket timeout
$ /usr/local/nagios/libexec/check_http -H google.com
HTTP OK: HTTP/1.1 301 Moved Permanently - 547 bytes in 2.574 second response time |time=2.573851s;;;0.000000 size=547B;;;0
port 443 is open on host. I have another nagios server which can use the same checks on my website

Code: Select all

$ nmap -sT -p 80,443 snapgeek.com
Starting Nmap 7.80 ( https://nmap.org ) at 2022-03-11 11:30 CST
Nmap scan report for snapgeek.com (99.198.101.250)
Host is up (0.019s latency).
rDNS record for 99.198.101.250: fastcomet

PORT    STATE SERVICE
80/tcp  open  http
443/tcp open  https

Nmap done: 1 IP address (1 host up) scanned in 15.08 seconds
atc0005
Posts: 26
Joined: Thu Oct 28, 2021 2:03 pm

Re: Nagios Core unreachable website checks

Post by atc0005 »

t3dus wrote:port 443 is open on host. I have another nagios server which can use the same checks on my website
Is the output you provided from the nagios server reporting "CRITICAL - Socket timeout", or from the second nagios server that you mentioned?

Do you get the same results when running "host snapgeek.com" from each nagios server?
User avatar
t3dus
Posts: 161
Joined: Thu Feb 04, 2016 3:46 pm
Location: IA
Contact:

Re: Nagios Core unreachable website checks

Post by t3dus »

atc0005 wrote:
t3dus wrote:port 443 is open on host. I have another nagios server which can use the same checks on my website
Is the output you provided from the nagios server reporting "CRITICAL - Socket timeout", or from the second nagios server that you mentioned?

Do you get the same results when running "host snapgeek.com" from each nagios server?
No that output is from this broken nagios server. The other server everything works and shows up like that google output.
Locked