azure,  mysql,  Sql,  Zabbix

Zabbix on VM remote MySql (Na market)

Lets continue and install Zabbix on a VM and MySql on another:

Basics
Subscription
Free Trial
Resource group
zabbix-rg
Virtual machine name
vm-zabbix
Region
West US
Availability options
No infrastructure redundancy required
Image
Ubuntu Server 18.04 LTS – Gen1
Size
Standard DS1 v2 (1 vcpu, 3.5 GiB memory)
Authentication type
Password
Username
espentest
Public inbound ports
SSH
Azure Spot
No
Disks
OS disk type
Standard HDD
Use managed disks
Yes
Use ephemeral OS disk
No
Networking
Virtual network
(new) zabbix-rg-vnet
Subnet
(new) default (10.0.0.0/24)
Public IP
(new) vm-zabbix-ip
Accelerated networking
Off
Place this virtual machine behind an existing load balancing solution?
No
Management
Boot diagnostics
On
OS guest diagnostics
Off
Azure Security Center
Basic (free)
System assigned managed identity
Off
Auto-shutdown
Off
Backup
Disabled
Patch installation
OS-orchestrated patching: patches will be installed by OS
Advanced
Extensions
None
Cloud init
No
Proximity placement group
None
Tags
Environment
Test (Auto-shutdown schedule)
Environment
Test (Availability set)
Environment
Test (Disk)
Environment
Test (Network interface)
Environment
Test (Network security group)
Environment
Test (Public IP address)
Environment
Test (Recovery Services vault)
Environment
Test (SSH key)
Environment
Test (Storage account)
Environment
Test (Virtual machine)
Environment
Test (Virtual machine extension)
Environment
Test (Virtual network)

Ok now we have one Ubuntu, cheap btw.

Lets make the database server:

We will use the same net at created for the vm-zabbix

Basics
Subscription
Free Trial
Resource group
zabbix-rg
Virtual machine name
vm-mysql
Region
West US
Availability options
No infrastructure redundancy required
Image
Ubuntu Server 18.04 LTS – Gen1
Size
Standard DS1 v2 (1 vcpu, 3.5 GiB memory)
Authentication type
Password
Username
espentest
Public inbound ports
SSH
Azure Spot
No
Disks
OS disk type
Standard HDD
Use managed disks
Yes
Use ephemeral OS disk
No
Networking
Virtual network
zabbix-rg-vnet
Subnet
default (10.0.0.0/24)
Public IP
(new) vm-mysql-ip
Accelerated networking
Off
Place this virtual machine behind an existing load balancing solution?
No

[…] is the same

So now we have to VM’s

Lets install mysql

https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-20-04

sudo apt update
sudo apt install mysql-server
sudo mysql_secure_installation

In the last step I kept all for the test, pass is the same as for VM, but that is not the correct for secure installation, choose several “YES”, you will see when you do it.

Lets ping vm-zabbix

Ok, lets install zabbix

https://www.zabbix.com/download?zabbix=5.0&os_distribution=ubuntu&os_version=18.04_bionic&db=mysql&ws=apache

Our disk’s

Ok, installing…..on vm-zabbix (we have to install mysql here but we will not use it, just the files)

wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1+bionic_all.deb
sudo dpkg -i zabbix-release_5.0-1+bionic_all.deb
sudo apt update
sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-agent

Login to MySql and create on vm-mysql

mysql -u root -p

create database zabbix character set utf8 collate utf8_bin;
create user zabbix@localhost identified by ‘xxxxxxxxxxxxx1234-‘;
grant all privileges on zabbix.* to zabbix@localhost;

Copy the create file from vm-zabbix to vm-mysql, Next thing we have to do is upload the correct schemas for the Zabbix installation. For this, we have to copy the schemas from the Zabbix server (the zabbix-mysql-server package)

Check that it arrived

Create and import the file in the database (check that the files are there, schema.sql, images.sql, data.sql)

Zabbix db

Tables

[…] and several more tables

vm-zabbix


e. Configure PHP for Zabbix frontend

Edit file /etc/zabbix/apache.conf, uncomment and set the right timezone for you.
php_value date.timezone Europe/Riga
f. Start Zabbix server and agent processes

Start Zabbix server and agent processes and make it start at system boot.
sudo systemctl restart zabbix-server zabbix-agent apache2
sudo systemctl enable zabbix-server zabbix-agent apache2

Check that apache is running

Now open the port on the nsg, 80 for HTTP

https://docs.microsoft.com/en-us/azure/virtual-machines/windows/nsg-quickstart-portal

Power down the vm, more another day

Check billing

Day 2

https://subscription.packtpub.com/book/networking_and_servers/9781784397586/1/ch01lvl1sec12/installing-the-server-in-a-distributed-setup

So on vm-mysql we must allow connection from all hosts:

espentest@vm-mysql:/etc/mysql/mysql.conf.d$ sudo nano mysqld.cnf
espentest@vm-mysql:/etc/mysql/mysql.conf.d$ sudo systemctl restart mysql

comment out bind….. (the bind-address can be in any mysql.cnf file, check all)

(did this also, not sure if it helped, sudo ufw allow 3306/tcp)

After that give the remote zabbix user access

espentest@vm-mysql:~$ sudo mysql -u root -p
mysql> grant all privileges on zabbix.* to zabbix@10.0.0.4 identified by ‘xxxxxxxxx1234-‘;
Query OK, 0 rows affected, 1 warning (0.01 sec)

On vm-zabbix. telnet now works (the first line is the telnet after ctrl-c, the second is what we gave as cmd to telnet)

Now alter zabbix config

/etc/zabbix/zabbix_server.conf

Tail the log and view/check the connection, here the connection is good

Open the agent port

sudo ufw allow 10051/tcp

Now lets configure front end, get the zabbix ip in azure

Visit the url


http://ip-addr/zabbix/setup.php

Give the private ip as input for db

Next, give zabbix a name

View details

Next…. and then second configuration is updated/created, the php config

Login, Admin, zabbix

And we are done

Edit and make a map, just to see if the icons are there, jepp!

Comments Off on Zabbix on VM remote MySql (Na market)