Nagios stop working
-
rbizzell39
- Posts: 112
- Joined: Thu Dec 17, 2015 1:24 pm
Nagios stop working
I installed NRPE and had that up and running as well as Nagios I was testing NRPE and it was up listening on the ports an I received a socket error when I was testing out communication with one of my windows server and now nagios won't start.
Error: Cannot open main configuration file '/etc/nagios/nagios.cfg' for reading!
Error processing main config file!
nagios.service: control process exited, code=exited status=1
Failed to start Nagios Network Monitoring.
Unit nagios.service entered failed state.
Time has been changed
Started Session 17502 of user root.
systemd: Starting Session 17502 of user root.
systemd: Created slice user-987.slice.
systemd: Starting user-987.slice.
Started Session 17501 of user cacti.
Starting Session 17501 of user cacti.
Removed slice user-987.slice.
Stopping user-987.slice.
Time has been changed
Error: Cannot open main configuration file '/etc/nagios/nagios.cfg' for reading!
Error processing main config file!
nagios.service: control process exited, code=exited status=1
Failed to start Nagios Network Monitoring.
Unit nagios.service entered failed state.
Time has been changed
Started Session 17502 of user root.
systemd: Starting Session 17502 of user root.
systemd: Created slice user-987.slice.
systemd: Starting user-987.slice.
Started Session 17501 of user cacti.
Starting Session 17501 of user cacti.
Removed slice user-987.slice.
Stopping user-987.slice.
Time has been changed
Re: Nagios stop working
Can you share the output of:
Code: Select all
ls -al /etc/nagios/Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
-
rbizzell39
- Posts: 112
- Joined: Thu Dec 17, 2015 1:24 pm
Re: Nagios stop working
ls -al /etc/nagios/
total 12
drwxrwxr-x 3 root root 20 Nov 10 11:31 .
drwxr-xr-x. 144 root root 8192 Nov 10 15:48 ..
drwxr-x--- 2 root nagios 26 Nov 10 11:31 objects
total 12
drwxrwxr-x 3 root root 20 Nov 10 11:31 .
drwxr-xr-x. 144 root root 8192 Nov 10 15:48 ..
drwxr-x--- 2 root nagios 26 Nov 10 11:31 objects
Re: Nagios stop working
It looks like the nagios.cfg file is not in that folder.
Was it moved to a different folder?
You can run the following to find the folder the nagios.cfg is is unless is was deleted.
Was it moved to a different folder?
You can run the following to find the folder the nagios.cfg is is unless is was deleted.
Code: Select all
find / -name nagios.cfgBe sure to check out our Knowledgebase for helpful articles and solutions!
-
rbizzell39
- Posts: 112
- Joined: Thu Dec 17, 2015 1:24 pm
Re: Nagios stop working
not sure what happen but I thought everything was under /usr/local/nagios and I was following the guide to install NRPE separately which I wouldn't have thought would have modified my nagios.cfg
-
rbizzell39
- Posts: 112
- Joined: Thu Dec 17, 2015 1:24 pm
Re: Nagios stop working
/home/rbizzell/Downloads/nagios-4.2.1/sample-config/nagios.cfg
/home/rbizzell/Downloads/nagios-4.2.1/t-tap/smallconfig/nagios.cfg
/home/rbizzell/Downloads/nagios-4.2.1/t/etc/nagios.cfg
find: ‘/run/user/1000/gvfs’: Permission denied
/root/nagios-4.0.8/sample-config/nagios.cfg
/root/nagios-4.0.8/t-tap/smallconfig/nagios.cfg
/root/nagios-4.0.8/t/etc/nagios.cfg
/root/nagios/etc/nagios.cfg
/usr/local/nagios/etc/nagios.cfg
/home/rbizzell/Downloads/nagios-4.2.1/t-tap/smallconfig/nagios.cfg
/home/rbizzell/Downloads/nagios-4.2.1/t/etc/nagios.cfg
find: ‘/run/user/1000/gvfs’: Permission denied
/root/nagios-4.0.8/sample-config/nagios.cfg
/root/nagios-4.0.8/t-tap/smallconfig/nagios.cfg
/root/nagios-4.0.8/t/etc/nagios.cfg
/root/nagios/etc/nagios.cfg
/usr/local/nagios/etc/nagios.cfg
-
rbizzell39
- Posts: 112
- Joined: Thu Dec 17, 2015 1:24 pm
Re: Nagios stop working
I have been using the one underneath /usr/local/nagios
Re: Nagios stop working
The nagios init script on your system is looking for the nagios.cfg file in this location
and it needs to be updated to this location and that should fix it for you.
On a Centos / Redhat system, the init script is located here
Take a look at it and adjust it to the correct path.
Code: Select all
/etc/nagios/nagios.cfgCode: Select all
/usr/local/nagios/etc/nagios.cfgCode: Select all
/etc/init.d/nagiosBe sure to check out our Knowledgebase for helpful articles and solutions!
-
rbizzell39
- Posts: 112
- Joined: Thu Dec 17, 2015 1:24 pm
Re: Nagios stop working
NagiosCfgFile=${prefix}/etc/nagios.cfg
Is this the line that I need to change /usr/local/nagios/etc/nagios.cfg
Is this the line that I need to change /usr/local/nagios/etc/nagios.cfg
-
rbizzell39
- Posts: 112
- Joined: Thu Dec 17, 2015 1:24 pm
Re: Nagios stop working
I made the changes to the init file and received this error
systemctl start nagios.service
Job for nagios.service failed because the control process exited with error code. See "systemctl status nagios.service" a nd "journalctl -xe" for details.
[root@splab-nagios init.d]# systemctl status nagios.service
● nagios.service - Nagios Network Monitoring
Loaded: loaded (/usr/lib/systemd/system/nagios.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2016-11-11 13:48:45 EST; 13s ago
Docs: https://www.nagios.org/documentation/
Process: 12074 ExecStartPre=/usr/sbin/nagios -v /etc/nagios/nagios.cfg (code=exited, status=1/FAILURE)
Nov 11 13:48:45 splab-nagios systemd[1]: Starting Nagios Network Monitoring...
Nov 11 13:48:45 splab-nagios systemd[1]: nagios.service: control process exited, code=exited status=1
Nov 11 13:48:45 splab-nagios systemd[1]: Failed to start Nagios Network Monitoring.
Nov 11 13:48:45 splab-nagios systemd[1]: Unit nagios.service entered failed state.
Nov 11 13:48:45 splab-nagios systemd[1]: nagios.service failed.
systemctl start nagios.service
Job for nagios.service failed because the control process exited with error code. See "systemctl status nagios.service" a nd "journalctl -xe" for details.
[root@splab-nagios init.d]# systemctl status nagios.service
● nagios.service - Nagios Network Monitoring
Loaded: loaded (/usr/lib/systemd/system/nagios.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2016-11-11 13:48:45 EST; 13s ago
Docs: https://www.nagios.org/documentation/
Process: 12074 ExecStartPre=/usr/sbin/nagios -v /etc/nagios/nagios.cfg (code=exited, status=1/FAILURE)
Nov 11 13:48:45 splab-nagios systemd[1]: Starting Nagios Network Monitoring...
Nov 11 13:48:45 splab-nagios systemd[1]: nagios.service: control process exited, code=exited status=1
Nov 11 13:48:45 splab-nagios systemd[1]: Failed to start Nagios Network Monitoring.
Nov 11 13:48:45 splab-nagios systemd[1]: Unit nagios.service entered failed state.
Nov 11 13:48:45 splab-nagios systemd[1]: nagios.service failed.