ERROR: Site Nagios does not exist. Help!

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.
Locked
a.lotton
Posts: 3
Joined: Thu Jan 19, 2017 3:22 pm

ERROR: Site Nagios does not exist. Help!

Post by a.lotton »

Hi there,

I have been following the Nagios Core from source installation tutorial. I ran into a problem while trying to run the command:

Code: Select all

sudo a2ensite nagios
I kept receiving ERROR: Site Nagios does not exist! After doing a little more research I thought I discovered that it was a problem with the suffix file being .cfg instead of .conf since I am running Apache 2.4.18

So I tried renaming and copying the file to the apache2 folder:

Code: Select all

sudo mv /tmp/nagios-4.2.0/sample-config/nagios.cfg /tmp/nagios-4.2.0/sample-config/nagios.conf
sudo cp /tmp/naigo-4.2.0/sample-config/nagios.conf /etc/apache2/sites-available
After running the first command the site was enabled.

On to the next step

Code: Select all

sudo a2enmod rewrite cgi

Module rewrite already enabled
AH00526: Syntax error on line 18 of /etc/apache2/sites-enabled/nagios.conf:
Invalid command 'log_file=/usr/local/nagios/var/nagios.log', perhaps misspelled or defined by a module not included in the server configuration
Module cgi already enabled

Code: Select all

systemctl restart apache2

Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details

Code: Select all

systemctl status apache2.service

● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: failed (Result: exit-code) since Thu 2017-01-19 12:41:07 PST;
     Docs: man:systemd-sysv-generator(8)
  Process: 28995 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
  Process: 28900 ExecReload=/etc/init.d/apache2 reload (code=exited, status=1/FAILURE)
  Process: 30812 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

Jan 19 12:41:07 AndyLinux apache2[30812]:  * The apache2 configtest failed.
Jan 19 12:41:07 AndyLinux apache2[30812]: Output of config test was:
Jan 19 12:41:07 AndyLinux apache2[30812]: AH00526: Syntax error on line 18 of /etc/apache2/site-enabled/nagios.conf:
Jan 19 12:41:07 AndyLinux apache2[30812]: Invalid command 'log_file=/usr/local/nagios/var/nagios.log', perhaps misspelled or defined by a module
Jan 19 12:41:07 AndyLinux apache2[30812]: Action 'configtest' failed.
Jan 19 12:41:07 AndyLinux apache2[30812]: The Apache error log may have more information.
Jan 19 12:41:07 AndyLinux systemd[1]: apache2.service: Control process exited, code=exited status=1
Jan 19 12:41:07 AndyLinux systemd[1]: Failed to start LSB: Apache2 web server.
Jan 19 12:41:07 AndyLinux systemd[1]: apache2.service: Unit entered failed state.
Jan 19 12:41:07 AndyLinux systemd[1]: apache2.service: Failed with result 'exit-code'.
I am very lost and would love some direction. Thank you!
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: ERROR: Site Nagios does not exist. Help!

Post by rkennedy »

It looks like you copied over the nagios.cfg file, and made it a .conf - this is not the correct file that apache2 needs. nagios.cfg is what Nagios actually uses to run, which explains this error -

Code: Select all

Invalid command 'log_file=/usr/local/nagios/var/nagios.log', perhaps misspelled or defined by a module not included in the server configuration
I would start fresh, and use our installation instructions available here - https://support.nagios.com/kb/article.p ... ategory=58
Former Nagios Employee
a.lotton
Posts: 3
Joined: Thu Jan 19, 2017 3:22 pm

Re: ERROR: Site Nagios does not exist. Help!

Post by a.lotton »

Ok wow I don't know what went wrong the first time I tried but this time around I did not receive any installation errors. Woot! I appreciate the link you suggested, thanks!

Feeling a little ignorant right now but I cannot access Nagios through the browser. I am using chrome. At both points in the instructions when it tells you to 'point your web browser to...' both options returns errors.

Putting in the IP address yields "http://10.25.5.143/nagios is unreachable."

Putting in the FQDN yields "core-013.domain.local’s server DNS address could not be found."

I'm in need of a little more guidance.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: ERROR: Site Nagios does not exist. Help!

Post by mcapra »

Are you able to ping your Nagios Core machine's IP from the machine you are trying to access the GUI from?

Can you also share your system's apache logs? They're usually found at /var/log/http or /var/log/apache2
Former Nagios employee
https://www.mcapra.com/
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: ERROR: Site Nagios does not exist. Help!

Post by avandemore »

Is Apache running?

Code: Select all

# service httpd status
Previous Nagios employee
a.lotton
Posts: 3
Joined: Thu Jan 19, 2017 3:22 pm

Re: ERROR: Site Nagios does not exist. Help!

Post by a.lotton »

I am unable to Pin the Nagios IP through terminal.

And apparently Apache does not exist? I can see all the files that were created when installing apache2

Code: Select all

service httpd status
● httpd.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)
Here are the log files:
Access.log
127.0.0.1 - - [25/Jan/2017:16:30:49 -0800] "GET / HTTP/1.0" 200 11595 "-" "check_http/v2.1.3.git (nagios-plugins 2.1.3)"
127.0.0.1 - - [25/Jan/2017:16:35:49 -0800] "GET / HTTP/1.0" 200 11595 "-" "check_http/v2.1.3.git (nagios-plugins 2.1.3)"
127.0.0.1 - - [25/Jan/2017:16:40:49 -0800] "GET / HTTP/1.0" 200 11595 "-" "check_http/v2.1.3.git (nagios-plugins 2.1.3)"
127.0.0.1 - - [25/Jan/2017:16:45:49 -0800] "GET / HTTP/1.0" 200 11595 "-" "check_http/v2.1.3.git (nagios-plugins 2.1.3)"
127.0.0.1 - - [25/Jan/2017:16:50:49 -0800] "GET / HTTP/1.0" 200 11595 "-" "check_http/v2.1.3.git (nagios-plugins 2.1.3)"
127.0.0.1 - - [25/Jan/2017:16:55:49 -0800] "GET / HTTP/1.0" 200 11595 "-" "check_http/v2.1.3.git (nagios-plugins 2.1.3)"
127.0.0.1 - - [25/Jan/2017:17:00:49 -0800] "GET / HTTP/1.0" 200 11595 "-" "check_http/v2.1.3.git (nagios-plugins 2.1.3)"
127.0.0.1 - - [25/Jan/2017:17:05:49 -0800] "GET / HTTP/1.0" 200 11595 "-" "check_http/v2.1.3.git (nagios-plugins 2.1.3)"
127.0.0.1 - - [25/Jan/2017:17:10:49 -0800] "GET / HTTP/1.0" 200 11595 "-" "check_http/v2.1.3.git (nagios-plugins 2.1.3)"
127.0.0.1 - - [25/Jan/2017:17:15:49 -0800] "GET / HTTP/1.0" 200 11595 "-" "check_http/v2.1.3.git (nagios-plugins 2.1.3)"
error.log
[Wed Jan 25 16:29:00.177360 2017] [mpm_prefork:notice] [pid 1383] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Wed Jan 25 16:29:00.177402 2017] [core:notice] [pid 1383] AH00094: Command line: '/usr/sbin/apache2'
[Wed Jan 25 17:09:51.194424 2017] [mpm_prefork:notice] [pid 1383] AH00169: caught SIGTERM, shutting down
[Wed Jan 25 17:09:52.316578 2017] [mpm_prefork:notice] [pid 6544] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Wed Jan 25 17:09:52.316640 2017] [core:notice] [pid 6544] AH00094: Command line: '/usr/sbin/apache2'
error.log.1
[Tue Jan 24 18:25:54.835662 2017] [mpm_prefork:notice] [pid 1544] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Tue Jan 24 18:25:54.835692 2017] [core:notice] [pid 1544] AH00094: Command line: '/usr/sbin/apache2'
[Tue Jan 24 22:12:01.798603 2017] [mpm_prefork:notice] [pid 1544] AH00169: caught SIGTERM, shutting down
[Wed Jan 25 08:23:56.688489 2017] [mpm_prefork:notice] [pid 1383] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Wed Jan 25 08:23:56.706961 2017] [core:notice] [pid 1383] AH00094: Command line: '/usr/sbin/apache2'
[Wed Jan 25 16:28:59.983969 2017] [mpm_prefork:notice] [pid 1383] AH00171: Graceful restart requested, doing restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: ERROR: Site Nagios does not exist. Help!

Post by dwhitfield »

Does port 80 show up if you run nmap localhost on the Core machine? On what OS/version are you running this?

If 80 is not open and you are running Ubuntu (possibly others) run sudo ufw allow80/tcp. On some versions of CentOS/RHEL you'll want to use firewall-cmd. You'll likely want to make sure it's persistent in some way. We can help out with that once we know which OS/version you are running.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: ERROR: Site Nagios does not exist. Help!

Post by tgriep »

What operating system and version is the server running?
Can you login to the server as root, run the following commands and post the output here?

Code: Select all

ps -ef --cols=300
ip addr
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked