Page 1 of 1

Unit mariadb.service could not be found.

Posted: Mon Nov 02, 2020 10:07 am
by amane
Hi,

We have installed Nagios XI on few servers however after installation below mentioned error occurred on Console.

Database Error
A database connection error has been detected, please follow the repair prompt below. If the issue persists, please contact Nagios support.
Run the following from the CLI as root to attempt to repair the DB:

/usr/local/nagiosxi/scripts/repair_databases.sh

Nagios repair succeeded after running above scripts on server but getting below mentioned error.

- recovering (with sort) MyISAM-table 'nagios_timeperiod_timeranges'
Data records: 33
- Fixing index 1
- Fixing index 2
Job for mysqld.service failed because the control process exited with error code.
See "systemctl status mysqld.service" and "journalctl -xe" for details.
Failed to start mariadb.service: Unit mariadb.service not found.
/home/nagios

===============
REPAIR COMPLETE
===============
DATABASE: nagiosql
TABLE:
Unit mariadb.service could not be found.
/var/lib/mysql/nagiosql /home/nagios
DATABASE: nagiosxi
TABLE:
Unit mariadb.service could not be found.
/var/lib/mysql/nagiosxi /home/nagios

=======================
nagios database repair succeeded


Also mysqld service is not running on server and ndo2db service is not available.

[nagios@lxappnagiprdw03 ~]$ service mysqld status
Redirecting to /bin/systemctl status mysqld.service
● mysqld.service - MySQL 8.0 database server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Mon 2020-11-02 09:48:53 EST; 6min ago
Process: 2544136 ExecStopPost=/usr/libexec/mysql-wait-stop (code=exited, status=0/SUCCESS)
Process: 1558641 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS)
Process: 2544114 ExecStart=/usr/libexec/mysqld --basedir=/usr (code=exited, status=1/FAILURE)
Process: 2544077 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service (code=exited, status=0/SUCCESS)
Process: 2544052 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
Main PID: 2544114 (code=exited, status=1/FAILURE)
Status: "Server startup in progress"
Error: 2 (No such file or directory)

[nagios@lxappnagiprdw03 ~]$ service nagios status
Redirecting to /bin/systemctl status nagios.service
● nagios.service - Nagios Core 4.4.6
Loaded: loaded (/usr/lib/systemd/system/nagios.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2020-11-02 09:48:53 EST; 7min ago
Docs: https://www.nagios.org/documentation
Process: 2544214 ExecStopPost=/usr/bin/rm -f /usr/local/nagios/var/rw/nagios.cmd (code=exited, status=0/SUCCESS)
Process: 2544212 ExecStop=/usr/bin/kill -s TERM ${MAINPID} (code=exited, status=0/SUCCESS)
Process: 2544218 ExecStart=/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg (code=exited, status=0/SUCCESS)
Process: 2544216 ExecStartPre=/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg (code=exited, status=0/SUCCESS)
Main PID: 2544219 (nagios)
Tasks: 26 (limit: 102397)
Memory: 18.3M
CGroup: /system.slice/nagios.service
├─2544219 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
├─2544221 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
├─2544222 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
├─2544223 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
├─2544224 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
├─2544225 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
├─2544226 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
├─2544227 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
├─2544228 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
├─2544229 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
├─2544230 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
├─2544231 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
├─2544232 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
├─2544233 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
├─2544234 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
├─2544235 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
├─2544236 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
├─2544237 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
├─2544238 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
├─2544239 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
├─2544240 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
├─2544241 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
├─2544242 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
├─2544243 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
└─2544244 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh


We have installed Nagios XI version 5.7.4 on RHEL 8.2

Re: Unit mariadb.service could not be found.

Posted: Mon Nov 02, 2020 2:52 pm
by benjaminsmith
HI,

Just want to confirm that this was installed on a clean, minimal distribution? Let's run the following commands on the server to collect some information to help troubleshoot.

1. Try to restart the service

Code: Select all

systemctl restart mysqld
#or
systemctl  restart mariadb
2. If that works, try connecting the nagios databse

Code: Select all

mysql -uroot -pnagiosxi -h 127.0.0.1 nagios
2. Database settings in XI. Post the following file.

Code: Select all

/usr/local/nagiosxi/html/config.inc.php
3. Database logs

Code: Select all

tail -n 100 /var/log/mysqld.log /var/log/mariadb/mariadb.log
4. Attach the system profile
Try generating it from the command line if you cannot access the GUI by running these commands as root and attach the profile.zip file.

Code: Select all

rm -rf /usr/local/nagiosxi/var/components/profile*
/usr/local/nagiosxi/scripts/components/getprofile.sh SUPPORT
Thanks,
Benjamin

Re: Unit mariadb.service could not be found.

Posted: Fri Nov 06, 2020 10:05 am
by amane
Hi benjaminsmith,

Thanks for the update.

mysqld restarting was failed on server.

root@<Server Name>~]# systemctl restart mysqld
Job for mysqld.service failed because the control process exited with error code.
See "systemctl status mysqld.service" and "journalctl -xe" for details.
[root@lxappnagiprdw03 ~]# systemctl status mysqld
● mysqld.service - MySQL 8.0 database server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2020-11-04 04:28:40 EST; 13s ago
Process: 3839646 ExecStopPost=/usr/libexec/mysql-wait-stop (code=exited, status=0/SUCCESS)
Process: 1558641 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS)
Process: 3839624 ExecStart=/usr/libexec/mysqld --basedir=/usr (code=exited, status=1/FAILURE)
Process: 3839587 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service (code=exited, status=0/SUCCESS)
Process: 3839562 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
Main PID: 3839624 (code=exited, status=1/FAILURE)
Status: "Server startup in progress"
Error: 2 (No such file or directory)
Nov 04 04:28:39 <Servername> systemd[1]: Starting MySQL 8.0 database server...
Nov 04 04:28:40 <Servername> systemd[1]: mysqld.service: Main process exited, code=exited, status=1/FAILURE
Nov 04 04:28:40 <Servername> systemd[1]: mysqld.service: Failed with result 'exit-code'.
Nov 04 04:28:40 <Servername> systemd[1]: Failed to start MySQL 8.0 database server.

Mysql is installed on server but it's not starting.

[root@<Server Name> ~]# yum list installed mysql
Updating Subscription Management repositories.
Installed Packages
mysql.x86_64 8.0.17-3.module+el8.0.0+3898+e09bb8de @rhel-8-for-x86_64-appstream-rpms

However we ran fullinstall again on server and Nagios XI console also visible but ndo2db service not found on server.
Below is the statuds for ndo2db service on server.

[root@<Server Name>nagiosxi]# /usr/local/nagiosxi/scripts/manage_services.sh status ndo2db
OK - Nagios XI 5.7 uses NDO3 build in and no longer uses the ndo2db service

Is there any DB related changes on Nagios XI version 5.7.4? Is there any impact if ndo2db is not running on Nagios XI server?

Thanks & Regards,
Avinash Mane

Re: Unit mariadb.service could not be found.

Posted: Fri Nov 06, 2020 5:25 pm
by benjaminsmith
HI,
Is there any DB related changes on Nagios XI version 5.7.4? Is there any impact if ndo2db is not running on Nagios XI server?
Glad to hear that cleared out when you ran the full install again. As of 5.7.x, XI no longer uses the ndo2db service; the backend database broker module was re-written for improved performance.

Let me know if you need any additional assistance or have more questions.

Benajmin