Nagios daemon is not running, cannot send restart command

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
User avatar
Shwele
Posts: 47
Joined: Tue Oct 03, 2017 3:00 am

Nagios daemon is not running, cannot send restart command

Post by Shwele »

Hello guys,

I've used nagios on my previous job. On my current one I wanted to set it up for monitoring due that we do not have such system implemented.
I'm using server that is on Linux Ubuntu 16.04 , with apache as vhost.

I've followed documentation for installing Nagios(4.3.4) and its plugins(release-2.2.1.tar.gz). All is well with that, but I'm currently having issues with NagiosQL.
I have installed 3.2 version of NagiosQL and set it up, due that soundforge was down at the time. After it was up again I realized that there is 3.3 version and patched it up with rsync over 3.2 one. Worked like a charm... but this.

Write monitoring data ✓
Write additional data ✓
Check configuration files: ✓
Restart Nagios: Nagios daemon is not running, cannot send restart command!

process output, to see that its running.

Code: Select all

ps aux | grep nagios
nagios    5798  0.0  0.5  29892  5324 ?        Ss   Oct03   0:09 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios    5804  0.0  0.2  12984  2312 ?        S    Oct03   0:00 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
nagios    5805  0.0  0.2  12984  2360 ?        S    Oct03   0:00 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
nagios    5806  0.0  0.2  12984  2360 ?        S    Oct03   0:00 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
nagios    5807  0.0  0.2  12984  2304 ?        S    Oct03   0:00 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
nagios    5821  0.0  0.1  25144  1648 ?        S    Oct03   0:08 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
Any hints how to solve this issue? Thanks in advance, I'm really hitting a head in the wall with this one.
dwasswa

Re: Nagios daemon is not running, cannot send restart comman

Post by dwasswa »

Hi [usr]shwele[/usr],

Just to verify a few things:

what version of nagios are you running?

Verify nagios configuration:
In order to verify your configuration, run Nagios Core binary with the -v command line option like so:

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Check if nagios is running with command:

Code: Select all

sudo systemctl start nagios.service
Did you restart nagios with this command..

Code: Select all

sudo service nagios restart
Make sure you have fulfilled all requirements:
The basic requirements are:

PHP 5.2.0 or greater including:
PHP Module: Session
PHP Module: MySQL
PHP Module: gettext
PHP Module: filter
PHP Module: XML
PHP Module: SimpleXML
PHP Module: FTP (optional)
PHP Module: curl (optional)
PECL Extension: SSH (optional)
php.ini options:
file_uploads on (for upload features)
session.auto_start needs to be off
A MySQL database server

To check for installed modules, run this command:

Code: Select all

php -m
To check the php version you are running,run this command:

Code: Select all

php -v
To get the list of installed php modules, you will probably find it helpful to get the list of the currently installed php packages in Ubuntu:

Code: Select all

sudo dpkg --get-selections | grep -v deinstall | grep php
To enable an installed module:

Code: Select all

phpenmod <modulename>
Reload Apache
Remember to reload Apache2 after enabling/disabling:

Code: Select all

service apache2 reload
User avatar
Shwele
Posts: 47
Joined: Tue Oct 03, 2017 3:00 am

Re: Nagios daemon is not running, cannot send restart comman

Post by Shwele »

Heya @dwasswa,

Thanks for replying to my issue!

Yes I did, also here with init as response:

Code: Select all

root@staging:~# /etc/init.d/nagios restart
[ ok ] Restarting nagios (via systemctl): nagios.service.
Here is php -v

Code: Select all

PHP 5.6.31-6+ubuntu16.04.1+deb.sury.org+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
    with Xdebug v2.5.5, Copyright (c) 2002-2017, by Derick Rethans
here is current list of modules installed on server:

Code: Select all

[PHP Modules]
calendar
Core
ctype
curl
date
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
imagick
json
libxml
mbstring
mcrypt
mhash
mysql
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xdebug
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Xdebug
Zend OPcache
php.ini options:
file_uploads on - this wasn't added
session.auto_start - its set to 0, so its off

Mysql packets:

Code: Select all

root@staging:/etc/php/5.6/cli# dpkg -l | grep mysql
ii  dbconfig-mysql                      2.0.4ubuntu1                                             all          dbconfig-common MySQL/MariaDB support
rc  libmysqlclient18:amd64              5.6.30-0ubuntu0.15.10.1                                  amd64        MySQL database client library
ii  mysql-client                        5.7.19-0ubuntu0.16.04.1                                  all          MySQL database client (metapackage depending on the latest version)
ii  mysql-client-5.7                    5.7.19-0ubuntu0.16.04.1                                  amd64        MySQL database client binaries
ii  mysql-client-core-5.7               5.7.19-0ubuntu0.16.04.1                                  amd64        MySQL database core client binaries
ii  mysql-common                        5.7.19-0ubuntu0.16.04.1                                  all          MySQL database common files, e.g. /etc/mysql/my.cnf
ii  mysql-server                        5.7.19-0ubuntu0.16.04.1                                  all          MySQL database server (metapackage depending on the latest version)
ii  mysql-server-5.7                    5.7.19-0ubuntu0.16.04.1                                  amd64        MySQL database server binaries and system database setup
ii  mysql-server-core-5.7               5.7.19-0ubuntu0.16.04.1                                  amd64        MySQL database server binaries

Code: Select all

root@staging:/etc/php/5.6/cli# dpkg --get-selections | grep -v deinstall | grep php
libapache2-mod-php5.6                           install
libapache2-mod-php7.0                           install
libapache2-mod-php7.1                           install
php                                             install
php-common                                      install
php-curl                                        install
php-gettext                                     install
php-imagick                                     install
php-mbstring                                    install
php-mcrypt                                      install
php-pear                                        install
php-phpseclib                                   install
php-tcpdf                                       install
php-xdebug                                      install
php-xml                                         install
php-zip                                         install
php5.6                                          install
php5.6-cgi                                      install
php5.6-cli                                      install
php5.6-common                                   install
php5.6-curl                                     install
php5.6-gd                                       install
php5.6-json                                     install
php5.6-mbstring                                 install
php5.6-mcrypt                                   install
php5.6-mysql                                    install
php5.6-opcache                                  install
php5.6-readline                                 install
php5.6-xml                                      install
php5.6-zip                                      install
php7.0                                          install
php7.0-cli                                      install
php7.0-common                                   install
php7.0-curl                                     install
php7.0-gd                                       install
php7.0-json                                     install
php7.0-mbstring                                 install
php7.0-mysql                                    install
php7.0-opcache                                  install
php7.0-readline                                 install
php7.0-xml                                      install
php7.1                                          install
php7.1-cli                                      install
php7.1-common                                   install
php7.1-curl                                     install
php7.1-json                                     install
php7.1-mbstring                                 install
php7.1-mcrypt                                   install
php7.1-opcache                                  install
php7.1-readline                                 install
php7.1-xml                                      install
php7.1-zip                                      install
phpmyadmin                                      install
At the moment I am unable to check whenever that file_uploads worked like a charm or not, but will check tomorrow. Hopefully you will have a guess or two what else to check/configure.

Ill check with that list of modules needed to be enabled to enable them and try first thing in the morning!

It seems the following are not present at all:
session
filter
XML
Simple XML
Last edited by Shwele on Wed Oct 04, 2017 12:45 pm, edited 1 time in total.
dwasswa

Re: Nagios daemon is not running, cannot send restart comman

Post by dwasswa »

Can you please unistall,nagiosql and the make a new clean install.

After the nagiosql new clean install please verify nagios core configuration file and restart service using below commands:

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Then restart the nagios service.
User avatar
Shwele
Posts: 47
Joined: Tue Oct 03, 2017 3:00 am

Re: Nagios daemon is not running, cannot send restart comman

Post by Shwele »

Ok, Ill uninstall it and install it again.

What about these php modules that are not present in the system at all?

Code: Select all

session
filter
XML
Simple XML
dwasswa

Re: Nagios daemon is not running, cannot send restart comman

Post by dwasswa »

If you have modules

Code: Select all

session
filter
XML
Simple XML
Then you have to install them and enable them with command

Code: Select all

phpenmod <modulename>
User avatar
Shwele
Posts: 47
Joined: Tue Oct 03, 2017 3:00 am

Re: Nagios daemon is not running, cannot send restart comman

Post by Shwele »

I have reinstalled nagios and nagiosQL, issue still persists.

Here is the output you asked of:

Code: Select all

root@staging:~# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 4.3.4
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2017-08-24
License: GPL

Website: https://www.nagios.org
Reading configuration data...
   Read main config file okay...
   Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
        Checked 21 services.
        Checked 4 hosts.
        Checked 4 host groups.
        Checked 0 service groups.
        Checked 1 contacts.
        Checked 1 contact groups.
        Checked 24 commands.
        Checked 5 time periods.
        Checked 0 host escalations.
        Checked 0 service escalations.
Checking for circular paths...
        Checked 4 hosts
        Checked 0 service dependencies
        Checked 0 host dependencies
        Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   0

Things look okay - No serious problems were detected during the pre-flight check
On nagios Core it says:
Daemon running with PID 6077

Command line agrees:
root@staging:~# ps aux | grep nagios

Code: Select all

nagios    6077  0.0  0.2  25652  2868 ?        Ss   13:06   0:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios    6086  0.0  0.2  12984  2232 ?        S    13:06   0:00 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
nagios    6087  0.0  0.2  12984  2220 ?        S    13:06   0:00 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
nagios    6088  0.0  0.2  12984  2236 ?        S    13:06   0:00 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
nagios    6089  0.0  0.2  12984  2244 ?        S    13:06   0:00 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
nagios    6104  0.0  0.1  25136  1700 ?        S    13:06   0:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios    6108  0.0  0.0  11020   776 ?        S    13:07   0:00 /usr/local/nagios/libexec/check_ping -H 192.168.1.30 -w 3000.0,80% -c 5000.0,100% -p 5
nagios    6109  0.0  0.0   6536   696 ?        S    13:07   0:00 /bin/ping -n -U -W 30 -c 5 192.168.1.30
Restarting nagiosQL via interface:

Code: Select all

Nagios daemon is not running, cannot send restart command!
For now I will restart it when config is needed to reload from configuration,in order to proceed with my work, but this is far from solution! Anything else I should check?

From what I've seen php session and filter are not used anymore and dont exist in apt-get repository.
Couldn't even find them on debian.packages.org to track down archives, so those modules are not needed and are not the ones causing this issue.

Could it be something in nagiosQL configuration file? I've only installed it and setup config targets, that aside didn't configure anything else!

Also im getting this error from the database, when I wanted to add new host:

Code: Select all

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`value' at line 4
User avatar
Shwele
Posts: 47
Joined: Tue Oct 03, 2017 3:00 am

Re: Nagios daemon is not running, cannot send restart comman

Post by Shwele »

Looks like the issue was that nagios.lock wasn't created.

In the end found this solution:
https://h3x.no/2010/06/30/failed-to-obt ... ion-denied

It worked for me.

As for SQL we can continue here or should I create another topic if I dont find it on forum?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios daemon is not running, cannot send restart comman

Post by scottwilkerson »

Lets post a different thread about that because this topic is not consistent with that issue.

Thanks, going to lock this one
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked