Nagios not working after Update

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.
Darth_Panda
Posts: 27
Joined: Sun Jun 28, 2015 7:01 am

Nagios not working after Update

Post by Darth_Panda »

Hi Guys,
I posted this is the Debian forums but I thoought I might post it here too just in case someone knows a quick fix. I am running Debian Wheezy with Nagios Core and Cacti. I ran this command to try and fix an issue with Exim - #apt-get install swaks libnet-ssleay-perl. The system proceeded to completely updated itself which took quite a few minutes. Now Nagios does not answer on the URL and I am also seeing this message below. Should I start with a new box or is there a way to save Nagios?

root@watchtower:~# dpkg-reconfigure apache2
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:' entry: please add even if empty.
insserv: missing `Default-Stop:' entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:' entry: please add even if empty.
insserv: missing `Default-Stop:' entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:' entry: please add even if empty.
insserv: missing `Default-Stop:' entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:' entry: please add even if empty.
insserv: missing `Default-Stop:' entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:' entry: please add even if empty.
insserv: missing `Default-Stop:' entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:' entry: please add even if empty.
insserv: missing `Default-Stop:' entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:' entry: please add even if empty.
insserv: missing `Default-Stop:' entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:' entry: please add even if empty.
insserv: missing `Default-Stop:' entry: please add even if empty.
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `nagios'
insserv: Default-Stop undefined, assuming empty stop runlevel(s) for script `nagios'
Restarting web server: apache2AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.16.1.231. Set the 'ServerName' directive globally to suppress this message
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Nagios not working after Update

Post by Box293 »

It may just be apache that is broken, nagios itself may still be running ok.

If nagios is running then thats a good thing.

Code: Select all

/etc/init.d/nagios status
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Darth_Panda
Posts: 27
Joined: Sun Jun 28, 2015 7:01 am

Re: Nagios not working after Update

Post by Darth_Panda »

Box293 wrote:It may just be apache that is broken, nagios itself may still be running ok.

If nagios is running then thats a good thing.

Code: Select all

/etc/init.d/nagios status
It still seems to be running. There are over 1000 host files that still seem to be in tact also.

root@watchtower:~# /etc/init.d/nagios status
nagios (pid 2979) is running...
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Nagios not working after Update

Post by Box293 »

Great.

What are the apache logs saying:

Code: Select all

tail -n 25 /var/log/apache2/error.log 
tail -n 25 /var/log/apache2/access.log
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Darth_Panda
Posts: 27
Joined: Sun Jun 28, 2015 7:01 am

Re: Nagios not working after Update

Post by Darth_Panda »

Box293 wrote:Great.

What are the apache logs saying:

Code: Select all

tail -n 25 /var/log/apache2/error.log 
tail -n 25 /var/log/apache2/access.log
root@watchtower:~# tail -n 25 /var/log/apache2/error.log
[Tue Jun 30 06:25:09.260472 2015] [mpm_prefork:notice] [pid 32179] AH00163: Apache/2.4.10 (Debian) PHP/5.6.9-0+deb8u1 configured -- resuming normal operations
[Tue Jun 30 06:25:09.260531 2015] [core:notice] [pid 32179] AH00094: Command line: '/usr/sbin/apache2'
[Tue Jun 30 08:45:52.038822 2015] [mpm_prefork:notice] [pid 32179] AH00169: caught SIGTERM, shutting down
[Tue Jun 30 08:45:53.094936 2015] [mpm_prefork:notice] [pid 14693] AH00163: Apache/2.4.10 (Debian) PHP/5.6.9-0+deb8u1 configured -- resuming normal operations
[Tue Jun 30 08:45:53.095028 2015] [core:notice] [pid 14693] AH00094: Command line: '/usr/sbin/apache2'

root@watchtower:~# tail -n 25 /var/log/apache2/access.log
root@watchtower:~# tail -n 25 /var/log/apache2/access.log
root@watchtower:~#
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Nagios not working after Update

Post by Box293 »

Darth_Panda wrote: Now Nagios does not answer on the URL
Run this command:

Code: Select all

tail -f /var/log/apache2/error.log
So what message are you getting in your browser when you access the URL? Also anything logged in the ssh session when you access the URL.

I did create a guide for installing Nagios Core from Source on Debian a while ago, have a look through this and see if any of this helps:

http://sites.box293.com/nagios/guides/i ... bian-7-7-0
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Darth_Panda
Posts: 27
Joined: Sun Jun 28, 2015 7:01 am

Re: Nagios not working after Update

Post by Darth_Panda »

Box293 wrote:
So what message are you getting in your browser when you access the URL? Also anything logged in the ssh session when you access the URL.

I did create a guide for installing Nagios Core from Source on Debian a while ago, have a look through this and see if any of this helps:

http://sites.box293.com/nagios/guides/i ... bian-7-7-0
This is what I get;

Not Found

The requested URL /nagios/ was not found on this server.
Apache/2.4.10 (Debian) Server at 172.16.1.98 Port 80

Thanks for the guide.
Darth_Panda
Posts: 27
Joined: Sun Jun 28, 2015 7:01 am

Re: Nagios not working after Update

Post by Darth_Panda »

Box293 wrote:
So what message are you getting in your browser when you access the URL? Also anything logged in the ssh session when you access the URL.

I did create a guide for installing Nagios Core from Source on Debian a while ago, have a look through this and see if any of this helps:

http://sites.box293.com/nagios/guides/i ... bian-7-7-0
Is there any way I could follow your instructions but re-install Nagios without starting from scratch. I have cacti which is still working so my preference would be to not wipe the hard drive.If I remove MySQL I think that will effect Cacti also.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Nagios not working after Update

Post by Box293 »

Honestly I just think the problem lies in apache so the main things I would look at are:

User And Group:

Code: Select all

grep nagios /etc/passwd
grep www-data /etc/passwd
grep nagios /etc/group
File permissions:

Code: Select all

chown -R nagios:nagios /usr/local/nagios
check appache users:

Code: Select all

htpasswd -c -b /usr/local/nagios/etc/htpasswd.users nagiosadmin nagiosadminpassword
is iptables installed / filewall rule allows inbound?

Code: Select all

iptables status
iptables -I INPUT -p tcp --destination-port 80 -j ACCEPT
apt-get install -y iptables-persistent
Some apache stuff:

Code: Select all

a2enmod rewrite
a2enmod cgi
/etc/init.d/apache2 restart


Apart from that not a lot is standing out.
Darth_Panda wrote:Is there any way I could follow your instructions but re-install Nagios without starting from scratch. I have cacti which is still working so my preference would be to not wipe the hard drive.If I remove MySQL I think that will effect Cacti also.
Honesly I haven't used Cactl and the Debian guide I created was a learning exercise for myself.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Darth_Panda
Posts: 27
Joined: Sun Jun 28, 2015 7:01 am

Re: Nagios not working after Update

Post by Darth_Panda »

[quote="Box293"]Honestly I just think the problem lies in apache so the main things I would look at are:

User And Group:

Code: Select all

grep nagios /etc/passwd
grep www-data /etc/passwd
grep nagios /etc/group
File permissions:

Code: Select all

chown -R nagios:nagios /usr/local/nagios
check appache users:

Code: Select all

htpasswd -c -b /usr/local/nagios/etc/htpasswd.users nagiosadmin nagiosadminpassword
is iptables installed / filewall rule allows inbound?

Code: Select all

iptables status
iptables -I INPUT -p tcp --destination-port 80 -j ACCEPT
apt-get install -y iptables-persistent
Some apache stuff:

Code: Select all

a2enmod rewrite
a2enmod cgi
/etc/init.d/apache2 restart


Apart from that not a lot is standing out.

Code: Select all

root@watchtower:~# grep nagios /etc/passwd
nagios:x:1000:1000:,,,:/home/nagios:/bin/bash
root@watchtower:~# grep www-data /etc/passwd
www-data:x:33:33:www-data:/var/www:/bin/sh
root@watchtower:~# grep nagios /etc/group
nagios:x:1000:www-data
root@watchtower:~# chown -R nagios:nagios /usr/local/nagios
root@watchtower:~# chown -R nagios:nagios /usr/local/nagios
root@watchtower:~# htpasswd -c -b /usr/local/nagios/etc/htpasswd.users nagiosadmin nagiosadminpassword
Adding password for user nagiosadmin
root@watchtower:~# iptables status
Bad argument `status'
Try `iptables -h' or 'iptables --help' for more information.
root@watchtower:~# iptables -I INPUT -p tcp --destination-port 80 -j ACCEPT
root@watchtower:~# apt-get install -y iptables-persistent
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  init-system-helpers netfilter-persistent
The following NEW packages will be installed:
  init-system-helpers iptables-persistent netfilter-persistent
0 upgraded, 3 newly installed, 0 to remove and 427 not upgraded.
2 not fully installed or removed.
Need to get 32.9 kB of archives.
After this operation, 247 kB of additional disk space will be used.
Get:1 http://mirror.optus.net/debian/ stable/main init-system-helpers all 1.22 [14.0 kB]
Get:2 http://mirror.optus.net/debian/ stable/main netfilter-persistent all 1.0.3 [8,036 B]
Get:3 http://mirror.optus.net/debian/ stable/main iptables-persistent all 1.0.3 [10.8 kB]
Fetched 32.9 kB in 0s (114 kB/s)          
Preconfiguring packages ...
Package configuration

























                     ┌────────────────────────────────────────────────────────────┠                    │ptables-persistent ├──────────────────────────────────────────────â│”€â”€â”€â”€â”€â”€â
                     │ Current iptables rules can be saved to the configuration file /etc/iptables/rules.v4. These rules will then be loaded automatically during system startup.      │
                     │                                                                                                                                                                 │
                     │ Rules are only saved automatically during package installation. See the manual page of iptables-save(8) for instructions on keeping the rules file up-to-date.  │
                     │                                                                                                                                                                 │
                     │ Save current IPv4 rules?                                                                                                                                        │
                     │                                                                                                                                                                 │
                     │                                                 <Yes>                                                    <No>                                                   │
                     │                                                                                                                                                                 │
                     └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
























                                                                                                                                                                                                             
Package configuration

























                     ┌────────────────────────────────────────────────────────────┠                    │ptables-persistent ├──────────────────────────────────────────────â”│€â”€â”€â”€â”€â”€â
                     │ Current iptables rules can be saved to the configuration file /etc/iptables/rules.v6. These rules will then be loaded automatically during system startup.       │
                     │                                                                                                                                                                  │
                     │ Rules are only saved automatically during package installation. See the manual page of ip6tables-save(8) for instructions on keeping the rules file up-to-date.  │
                     │                                                                                                                                                                  │
                     │ Save current IPv6 rules?                                                                                                                                         │
                     │                                                                                                                                                                  │
                     │                                                 <Yes>                                                    <No>                                                    │
                     │                                                                                                                                                                  │
                     └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
























Selecting previously unselected package init-system-helpers.                                                                                                                                                 
(Reading database ... 49562 files and directories currently installed.)
Preparing to unpack .../init-system-helpers_1.22_all.deb ...
Unpacking init-system-helpers (1.22) ...
Selecting previously unselected package netfilter-persistent.
Preparing to unpack .../netfilter-persistent_1.0.3_all.deb ...
Unpacking netfilter-persistent (1.0.3) ...
Selecting previously unselected package iptables-persistent.
Preparing to unpack .../iptables-persistent_1.0.3_all.deb ...
update-rc.d: using dependency based boot sequencing
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `nagios'
insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `nagios'
Unpacking iptables-persistent (1.0.3) ...
Processing triggers for man-db (2.7.0.2-5) ...
Setting up nagios3-common (3.5.1.dfsg-2) ...
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `nagios'
insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `nagios'
Starting nagios3 monitoring daemon: nagios3
Nagios Core 3.5.1
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-30-2013
License: GPL

Website: http://www.nagios.org
Reading configuration data...
Error: Cannot open resource file '/etc/nagios3/resource.cfg' for reading!
   Read main config file okay...
Processing object config file '/etc/nagios3/commands.cfg'...
Error: Cannot open config file '/etc/nagios3/commands.cfg' for reading: No such file or directory
   Error processing object config files!


***> One or more problems was encountered while processing the config files...

     Check your configuration file(s) to ensure that they contain valid
     directives and data defintions.  If you are upgrading from a previous
     version of Nagios, you should be aware that some variables/definitions
     may have been removed or modified in this version.  Make sure to read
     the HTML documentation regarding the config files, as well as the
     'Whats New' section to find out what has changed.

errors in config! ... failed!
 failed!
invoke-rc.d: initscript nagios3, action "start" failed.
dpkg: error processing package nagios3-common (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of nagios3-core:
 nagios3-core depends on nagios3-common (= 3.5.1.dfsg-2); however:
  Package nagios3-common is not configured yet.

dpkg: error processing package nagios3-core (--configure):
 dependency problems - leaving unconfigured
Setting up init-system-helpers (1.22) ...
Setting up netfilter-persistent (1.0.3) ...
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `nagios'
insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `nagios'
Loading netfilter rules...run-parts: executing /usr/share/netfilter-persistent/plugins.d/15-ip4tables start
Warning: skipping IPv4 (no rules to load)
run-parts: executing /usr/share/netfilter-persistent/plugins.d/25-ip6tables start
Warning: skipping IPv6 (no rules to load)
done.
Setting up iptables-persistent (1.0.3) ...
update-rc.d: using dependency based boot sequencing
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `nagios'
insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `nagios'
Errors were encountered while processing:
 nagios3-common
 nagios3-core
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@watchtower:~# a2enmod rewrite
Enabling module rewrite.
To activate the new configuration, you need to run:
  service apache2 restart
root@watchtower:~# a2enmod cgi
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.16.1.231. Set the 'ServerName' directive globally to suppress this message
Module cgi already enabled
root@watchtower:~# /etc/init.d/apache2 restart
Restarting web server: apache2AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.16.1.231. Set the 'ServerName' directive globally to suppress this message
.
Locked