azure,  mysql

Azure for MySql single server (with Zabbix)

  • Make ubuntu vm
  • Make Azure for MySql single server
  • Add 2 NSG to the vm
  • Add firwale rules to the MySQL
  • Install and configure Zabbix
  • Connect to MySQL with HeidiSQL
  • Connect Zabbix to MySQL
  • Configure frontend

Azure Database for MySQL documentation | Microsoft Docs

Note port 3306 vs 3309 for client. If you install Zabbix 6, it needs MySql v8, use port 3309.

3309

Connect to a gateway node to a specific MySQL version

Azure Database for MySQL managing updates and upgrades | Microsoft Docs

Make Paas Mysql singel server and one Ubuntu vm

When you provision the vm, make a public ip for it. (Just for test now)

MySql Paas

Ubuntu vm

Make 2 inbound rules. One for SSH and one for HTTP

Connect

Verify that you can connect to the ubuntu vm

Verify that you can connect to MySQL

Step 1: Obtain SSL certificate Download the certificate needed to communicate over SSL with your Azure Database for MySQL server from https://www.digicert.com/CACerts/BaltimoreCyberTrustRoot.crt.pem and save the certificate file to your local drive

In HeidiSQL add the cert

Verify port 3306

Verify port 3309

On the ubuntu vm do

Download and install Zabbix 6.0 LTS for Ubuntu 20.04 (Focal), MySQL, Apache

Install and configure Zabbix for your platform

a. Install Zabbix repository
# wget https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.0-3%2Bubuntu20.04_all.deb
# sudo dpkg -i zabbix-release_6.0-3+ubuntu20.04_all.deb
# sudo apt update

b. Install Zabbix server, frontend, agent
   For not a localhost mysql, but all dependencies for mysql
# sudo apt-get install --no-install-recommends zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent
# or
# sudo apt install --no-install-recommends zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent

# sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent

On the MySql Paas in HeidiSQL

# c. Create initial database
create database zabbix character set utf8mb4 collate utf8mb4_bin;

create user zabbix@ip identified by 'thepassword';
grant all privileges on zabbix.* to zabbix@ip;

# for prod use ip, not the (or '%' for all)
    
create user zabbix@'%' identified by 'thepassword';
grant all privileges on zabbix.* to zabbix@ip;

On the ubuntu vm, connect to the MySql Pass

mysql -u zabbix@yourhost -h your-host.mysql.database.azure.com -P 3309 --password=thepassword

You will get an connection error for IP, add the IP to MySql Paas->Connection security tab

(The clientIP…. and new_ip is just for SSH with HeidiSql)

Now verify version for mysql (if 3306 was used, zabbix would report too low MySql version and not start)

Still on the ubuntu vm

# On Zabbix server host import initial schema and data.
# navigate to server.sql.gz

zcat server.sql.gz | mysql --default-character-set=utf8mb4 -u zabbix@yourhost -h yourhost.mysql.database.azure.com -P 3309 -password=thepassword -p Zabbix

# this can take 1-5 min

When zcat is done, there should be two users: administrator and guest

In HeidiSQL, show tables

and view users

Btw it is innoDB

On the ubuntu vm configure zabbix

# d. Configure the database for Zabbix server
# take a backup sudo cp zabbix_server.conf zabbix_server.conf.bck
# Edit file /etc/zabbix/zabbix_server.conf

# DBHost=yourhost.mysql.database.azure.com
# DBname=zabbix
# DBPassword=thepassword
# DBUser=zabbix@yourhost.mysql.database.azure.com
# DBPort=3309

# restart zabbix and apache
# sudo service zabbxi-server stop, start, status
# sudo service apache2 stop, start, status
# view logs
# tail -f /var/log/zabbix/zabbix_server.log


# e. Start Zabbix server and agent processes and make them start at boot
# sudo systemctl restart zabbix-server zabbix-agent apache2
# sudo systemctl enable zabbix-server zabbix-agent apache2

In HeidiSql you can show processlist; to get all connections and IP.

6 Web interface installation (zabbix.com)

Now we can configure the frontend

Since we have an public IP here, we added HTTP 80 for the ubuntu-vm in the beginning.

Now we can visit it. http://ip

You should see apache

Now visit

http://ip/zabbix

Check prerequisites

Now configure the frontend, we use the same as we used in the zabbix_server.conf

Set a name, theme and time-zone

Verify pre

You will now get a conf/zabbix.conf.php for the frontend with the details you entered. If you need to change, then the file is there.

Login with default

Done

Comments Off on Azure for MySql single server (with Zabbix)