Nagios core not running, service ist started

Engage with the community of users including those using the open source solutions.
Includes Nagios Core, Plugins, and NCPA

Nagios core not running, service ist started

Postby Goulasch » Fri Feb 14, 2020 2:34 am

Nagios version Version 4.3.4, HA-Proxy version 1.7.5-2

The service has started.

Nagios is installed on a member server (not DC). A proxy server with HAproxy is set up for remote access.

If the server is accessed directly in the local network, it is shown that the daemon is running and all services can be accessed and displayed.
If access is remote, the request is forwarded to the same member server via a HAproxy. Then the Nagios message (Nagios Core) "Not running" appears.

A trace showed that with local access
ip.of.nagios.server - Administrator [13/Feb/2020:20:24:28 +0100] "GET /nagios3/side.php HTTP/1.1" 200 1438 "https://local.com/nagios3/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:72.0) Gecko/20100101 Firefox/72.0"
ip.of.nagios.server - Administrator [13/Feb/2020:20:24:28 +0100] "GET /nagios3/main.php HTTP/1.1" 200 2885 "https://local.com/nagios3/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:72.0) Gecko/20100101 Firefox/72.0"
ip.of.nagios.server - Administrator [13/Feb/2020:20:24:28 +0100] "GET /nagios3/stylesheets/common.css?4.3.4 HTTP/1.1" 200 2905 "https://local.com/nagios3/side.php" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:72.0) Gecko/20100101 Firefox/72.0"
ip.of.nagios.server - Administrator [13/Feb/2020:20:24:29 +0100] "GET /nagios3/stylesheets/nag_funcs.css?4.3.4 HTTP/1.1" 200 986 "https://local.com/nagios3/main.php" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:72.0) Gecko/20100101 Firefox/72.0"
ip.of.nagios.server - Administrator [13/Feb/2020:20:24:29 +0100] "GET /cgi-bin/nagios/statusjson.cgi?query=programstatus HTTP/1.1" 200 1565 "https://local.com/nagios3/main.php" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:72.0) Gecko/20100101 Firefox/72.0"

and with remote access
ip.of.haproxy.server - Administrator [13/Feb/2020:20:23:55 +0100] "GET /nagios/ HTTP/1.1" 200 4403 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Mobile/15E148 Safari/604.1"
ip.of.haproxy.server - Administrator [13/Feb/2020:20:23:56 +0100] "GET /nagios/main.php HTTP/1.1" 200 2833 "https://remote.com/nagios/" "Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Mobile/15E148 Safari/604.1"
ip.of.haproxy.server - Administrator [13/Feb/2020:20:23:56 +0100] "GET /nagios/side.php HTTP/1.1" 200 1539 "https://remote.com/nagios/" "Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Mobile/15E148 Safari/604.1"
ip.of.haproxy.server - Administrator [13/Feb/2020:20:23:56 +0100] "GET /nagios/?query=programstatus HTTP/1.1" 200 1022 "https://remote.com/nagios/main.php" "Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Mobile/15E148 Safari/604.1"

There is a difference in the last "GET" of the path but I have no explanation for it.

Here is an excerpt from haproxy.cfg (access is always only via SSL):
...
frontend https-in
bind *:443 ssl crt /etc/haproxy/cert/haproxy.pem
reqadd X-Forwarded-Proto:\ https

# Define hosts: criteria subdir
acl host_nagios path_beg -i /nagios
acl host_nagios path_beg /nagios
acl host_nagios path_beg /cgi-bin/nagios
.....
use_backend nagios_servers if host_nagios
.....
backend nagios_servers

server nagios local.nagios.server:443 ssl verify none check
...
### End manual additions - proxy section

Tracing the log of the HAproxy shows, that only the backend "nagios_servers" is involved (as expected).

Because the only difference between local and remote access seems to be the HAproxy, I suspect that something is generally wrong with the URL, the path or the header (in total) and/or what needs to be changed so that the remote access is also successful.

Any help is appreciated.
Attachments
Nagios core not running.png
Nagios core not running.png (88.12 KiB) Viewed 587 times
Goulasch
 
Posts: 4
Joined: Fri Feb 14, 2020 1:42 am

Re: Nagios core not running, service ist started

Postby benjaminsmith » Fri Feb 14, 2020 1:57 pm

Hello @Goulasch,

First of all, thanks for joining the Nagios Support Forum and using Nagios Core. One thing to review is a curl command from the remote access host to the Nagios Server.

Code: Select all
curl -k -L -v https://<ip address>/nagios

Proxies can be set up but we don't have any specific documentation regarding the process. I would also recommend reviewing the documentation for HA PRoxy for help.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
benjaminsmith
 
Posts: 3232
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Nagios core not running, service ist started

Postby Goulasch » Fri Feb 14, 2020 4:56 pm

any idear to use curl remote, if a proxy is the only gateway from/to remote ?

Proxies can be set up but we don't have any specific documentation regarding the process.

You are not alone; same to HAproxy :-)
Goulasch
 
Posts: 4
Joined: Fri Feb 14, 2020 1:42 am

Re: Nagios core not running, service ist started

Postby Goulasch » Sat Feb 15, 2020 9:29 am

which Nagios program/script decide whether to use
Code: Select all
status.cgi

or
Code: Select all
statusjson.cgi

and under which condition ?
Goulasch
 
Posts: 4
Joined: Fri Feb 14, 2020 1:42 am

Re: Nagios core not running, service ist started

Postby Goulasch » Sun Feb 16, 2020 12:52 pm

Found the issue !

Changed the cgi-path in the ".../config.inc.php" file in the www-directory of Nagios from
Code: Select all
$cfg['cgi_base_url']='/cgi-bin/nagios';

to
Code: Select all
$cfg['cgi_base_url']='/nagios/cgi-bin';

which solved the problem with the remote access via an HAproxy
Goulasch
 
Posts: 4
Joined: Fri Feb 14, 2020 1:42 am

Re: Nagios core not running, service ist started

Postby scottwilkerson » Mon Feb 17, 2020 7:43 am

Great!

Locking thread
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 18921
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises


Return to Community Support

Who is online

Users browsing this forum: Bing [Bot], G_Deshpande, Google [Bot] and 24 guests