Page 1 of 1

AWS AMI mysqld/mariadb

Posted: Wed May 22, 2024 10:20 am
by cbeattie-unitrends
Hello,
I have successfully migrated a Nagios XI instance in AWS from the old CentOS 7 AMI to the CentOS Stream 9 AMI (it's the only one with owner 766915741798). I have just one question about it. The new instance appears to have MySQL installed instead of MariaDB:

Code: Select all

# rpm -qa | grep -E 'maria|mysql'
mariadb-connector-c-config-3.2.6-1.el9.noarch
mysql-common-8.0.36-1.el9.x86_64
mysql-8.0.36-1.el9.x86_64
mariadb-connector-c-3.2.6-1.el9.x86_64
mysql-errmsg-8.0.36-1.el9.x86_64
mysql-libs-8.0.36-1.el9.x86_64
php-mysqlnd-8.0.30-1.el9.x86_64
mysql-selinux-1.0.10-1.el9.noarch
mysql-devel-8.0.36-1.el9.x86_64
mysql-server-8.0.36-1.el9.x86_64
The service check for mysqld is in a critical state, with status information "(Return code of 4 for service 'Service Status - mysqld' on host 'localhost' was out of bounds)".

The database is running just fine. However, the script /usr/local/nagiosxi/scripts/manage_services.sh looks like it's set to accept 'mysqld' as an argument but change the service name to 'mariadb' around line 108.

This isn't anything I'm worrying about. I'd update the script so it uses the correct service name, but I'm merely mildly concerned it would get overwritten during an update.

Thanks.

Re: AWS AMI mysqld/mariadb

Posted: Thu May 23, 2024 9:24 am
by jmichaelson
i'm curious how you went about migrating from cent 7 to cent 9. did you directly upgrade the instance OS, or did you stand up a new instance? if the former, I can understand how it ended up still having Mysql instead of Maria. when doing OS upgrades, we do recommend standing up a new instance and then migrating the data over. If you did go the new instance route, then we'll have to look into it further.

Re: AWS AMI mysqld/mariadb

Posted: Fri May 24, 2024 9:03 am
by cbeattie-unitrends
I followed the docs (https://assets.nagios.com/downloads/nag ... -Cloud.pdf) and stood up a new instance using the CentOS Stream 9 AMI whose owner was 766915741798. Then I followed the Nagios XI 2024+ backup/restore docs (https://nagiosenterprises.my.site.com/s ... 4-b36feda0).

This is the AMI I found, in Community AMIs:
Nagios XI on CentOSS 9
ami-0ebea3ac11a8ad77e

Nagios XI CentOS Stream 9
OwnerAlias: –
Platform: Cent OS
Architecture: x86_64
Owner: 766915741798
Publish date: 2022-12-08
Root device type: ebs
Virtualization: hvm
ENA enabled: Yes

As far as I can recall, every check that was still enabled on the old instance was in an OK state. I think it had MariaDB installed. The check went critical running on the CentOS Stream 9 VM.

I did try to modify the check script to avoid any reference to MariaDB, but I wasn't successful and I didn't try very hard and restored the original after a few minutes. However, the script should have worked fine as-is.

Running the command the script should execute works fine, but somehow mariadb is getting in there and I'm 100% baffled:

Code: Select all

[ec2-user@ip-xxxxx ~]$ `which systemctl` --no-pager status mysqld -n 0
● mysqld.service - MySQL 8.0 database server
     Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; preset: disabled)
     Active: active (running) since Tue 2024-05-21 21:27:21 UTC; 2 days ago
    Process: 648 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
    Process: 712 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service (code=exited, status=0/SUCCESS)
   Main PID: 934 (mysqld)
     Status: "Server is operational"
      Tasks: 111 (limit: 22592)
     Memory: 1.6G
        CPU: 3h 49min 23.591s
     CGroup: /system.slice/mysqld.service
             └─934 /usr/libexec/mysqld --basedir=/usr
[ec2-user@ip-xxxxx ~]$ sudo /usr/local/nagiosxi/scripts/manage_services.sh status mysqld
Unit mariadb.service could not be found.

Re: AWS AMI mysqld/mariadb

Posted: Fri May 24, 2024 4:14 pm
by jmichaelson
What version of Nagios XI does the EC2 instance have on it? Looking by the dates it looks like something from 202, and I see the EC2 doc is from a year ago. I'm wondering if we have one or more of those things out of date. Let me know and I'll look further into that.

Re: AWS AMI mysqld/mariadb

Posted: Tue May 28, 2024 8:52 am
by cbeattie-unitrends
The AWS instance is currently Nagios XI 2024R1.1.2, but I think this AMI installs the latest version of Nagios XI on itself on first boot, from looking at the package transaction history. Maybe latest? I'm not sure how it got nagiosxi-deps 1.1.1 when XI is 1.1.2. Either way, no 2024 version of XI existed in 2022.

Code: Select all

# dnf history
ID     | Command line                                                                                               | Date and time    | Action(s)      | Altered
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
    17 | -y update                                                                                                  | 2024-05-28 13:12 | I, U           |   32
    16 | update                                                                                                     | 2024-05-22 14:56 | Upgrade        |    1
    15 | -y install htop                                                                                            | 2024-05-22 14:22 | Install        |    2
    14 | -y install ncdu                                                                                            | 2024-05-21 20:39 | Install        |    1
    13 | -y install vim                                                                                             | 2024-05-21 18:28 | Install        |    4
    12 | install scons gcc-c++ -y                                                                                   | 2024-05-20 20:33 | Install        |    1
    11 | install lftp -y                                                                                            | 2024-05-20 20:32 | Install        |    1
    10 | install whois -y                                                                                           | 2024-05-20 20:32 | Install        |    2
     9 | -y install chromium chromium-headless                                                                      | 2024-05-20 20:30 | Install        |   78 EE
     8 | -y localinstall /tmp/nagiosxi/nagiosxi-deps-el9-2024r1.1.1-1.noarch.rpm                                    | 2024-05-20 20:20 | Install        |  701 E<
     7 | install epel-release -y                                                                                    | 2024-05-20 20:19 | Install        |    2 ><
     6 | install wget centos-release -y                                                                             | 2024-05-20 20:19 | Install        |    1 >
     5 | reinstall ca-certificates -y                                                                               | 2024-05-20 20:18 | R              |    2
     4 | update -y                                                                                                  | 2024-05-20 20:12 | I, U           |  252 E<
     3 | -C -y --noplugins remove firewalld --setopt=clean_requirements_on_remove=1                                 | 2022-11-29 10:09 | Removed        |   13 >E
     2 | -C -y --noplugins remove linux-firmware                                                                    | 2022-11-29 10:09 | Removed        |    2
     1 |                                                                                                            | 2022-11-29 10:05 | Install        |  363 EE

Re: AWS AMI mysqld/mariadb

Posted: Tue May 28, 2024 9:21 am
by swolf
I will say that I've seen EL9 systems with either database installed. To answer your original ask:

1. Yes, a change to that script would get overwritten in a future release.
2. Feel free to change the script for now (possibly after an upgrade to 2024R1.1.3, which is coming today or tomorrow), and we'll make sure manage_services.sh is robust to the possibility of either mariadb or mysqld existing in our summer release.

Hopefully that helps - please let us know if you have any other concerns.
-Sebastian

Re: AWS AMI mysqld/mariadb

Posted: Wed Feb 12, 2025 11:07 am
by cbeattie-unitrends
I figured out what was happening here. An xi-sys.cfg file contained the line mysqld='mariadb'. I suspect it was carried over from the Nagios XI backup made from the previous installation on CentOS 7 somehow.

There were five instances of xi-sys.cfg containing that line:

Code: Select all

# find / | grep xi-sys.cfg
/tmp/nagiosxi/nagiosxi/basedir/etc/xi-sys.cfg
/tmp/nagiosxi/nagiosxi/basedir/var/xi-sys.cfg
/tmp/nagiosxi/xi-sys.cfg
/usr/local/nagiosxi/etc/xi-sys.cfg
/usr/local/nagiosxi/var/xi-sys.cfg
Once I ran chmod o+w and sed -i 's/mariadb/mysqld/' on each of those files, I was finally able to update Nagios XI to 2024R1.3.3.