Brainy Pi

Available to select audience (currently beta)

Zabbix is an open-source network monitoring and management software that helps organizations monitor the performance and availability of their IT infrastructure. It offers a wide range of monitoring capabilities for servers, networks, applications, and logs. Zabbix collects data from various sources, analyzes it, and provides insights through customizable dashboards, performance graphs, and reports. It also includes an alerting and notification system to promptly notify administrators of any issues. Overall, Zabbix is a flexible and powerful tool for proactive monitoring and management of IT resources. Let’s explore Zabbix on Brainy Pi.

Pre-Requisites

  1. Update you system packages
    sudo apt update
  2. NGNIX web server should be installed and make sure it has been setup to use php.
Installing NGNIX
  • install NGNIX
sudo apt install nginx
  • Start its service
sudo systemctl start nginx
Configuring NGNIX for PHP
  • Installing dependencies
sudo apt install php7.4-fpm php7.4-mbstring php7.4-mysql php7.4-curl php7.4-gd php7.4-curl php7.4-zip php7.4-xml -y
  • Making changes to the default NGNIX file
sudo nano /etc/nginx/sites-enabled/default
Find the line:
index index.html index.htm;
And replace it with:
index index.php index.html index.htm;
Then, find:
#location ~ \.php$ {
        #       include snippets/fastcgi-php.conf;
        #
        #       # With php5-cgi alone:
        #       fastcgi_pass 127.0.0.1:9000;
        #       # With php5-fpm:
        #       fastcgi_pass unix:/var/run/php5-fpm.sock;
        #}
and replace with:
location ~ \.php$ {
               include snippets/fastcgi-php.conf;
               fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        }
Save and exit the file.
  • Reload the NGNIX sevrvice
sudo systemctl reload nginx
  • Setting up the php
sudo nano /var/www/html/index.php
to this file add the following line of code
<?php phpinfo(); ?>
save and exit.
  • Now you can go to your web sever and enter
http://<YOUR PI's IP ADDRESS>
You would be greeted with NGNIX home page.
  1. Device should have MySQL installed on it.

Installing MYSQL

  • Install the MYSQL server software
sudo apt install mariadb-server
  • setting a password for the root user
sudo mysql_secure_installation
Just follow the prompts to set a password for the root user and to secure your MySQL installation.
  • Now you can make changes to your MYSQL server using
sudo mysql -u root -p
To exit MYSQL you can either use quit or ctrl + d.

Installing Zabbix on Brainy Pi

  1. Adding Zabbix server repository to our device using wget.
    wget https://repo.zabbix.com/zabbix/6.2/raspbian/pool/main/z/zabbix-release/zabbix-release_6.2-2%2Bdebian11_all.deb
  2. Once the packages are downloaded, we can use the dpkg tool to install it.
    sudo dpkg -i zabbix-release_6.2-2+debian11_all.deb
  3. Update your packages so that the system gets aware of zabbix packages
    sudo apt update
  4. Install the Zabbix server, its frontend interface, and its agent software.
    sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-nginx-conf zabbix-sql-scripts zabbix-agent

Setting up the Zabbix server on Brainy Pi

Configure the SQL Database for Zabbix

  1. We need to start by loading up the MySQL command-line tool.
    sudo mysql -uroot -p
  2. Creating a database called zabbix
    CREATE DATABASE zabbix CHARACTER SET utf8 collate utf8_bin;
  3. Create a user called “zabbix” that will be used to access the new database.
    CREATE USER zabbix@localhost IDENTIFIED BY 'PASSWORDHERE';
  4. Finally, with both the user and database created, we need to grant some privileges.
    GRANT ALL PRIVILEGES on zabbix.* to zabbix@localhost;
  5. Exit the database
    quit;
  6. Import the tables and initial Zabbix data.
    zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix
    Before proceeding, you will need to enter the password you set for the “zabbix” user earlier in this guide. Please note this process can take some time as it needs to insert a lot of data into the SQL database.

Modifying the Zabbix Server Configuration

We now need to modify the configuration file for the Zabbix server to set the password for the database.
Without this, Zabbix won’t know how to connect itself to our Pi’s MySQL software.
  1. Modifying the Zabbix server configuration
    sudo nano /etc/zabbix/zabbix_server.conf
  2. Using ctrl + w fine the line that says
    #DBPassowrd=
    Uncomment this line and add your zabbix password here. It should look like:
    DBPassword=PASSWORD
    Save and exit

Reconfiguring NGINX for the Zabbix Frontend

  1. Modify the default NGINX configuration to point at the Zabbix config file.
    sudo nano /etc/nginx/nginx.conf
  2. Find the following line using ctrl + w
    include /etc/nginx/sites-enabled/*;
    and add the following line below it
    include /etc/zabbix/nginx.conf;
    save and exit
  3. Modify the Zabbix configuration file
    sudo nano /etc/zabbix/nginx.conf
    Within this file, find the following line and uncomment it.
    This line should be somewhere near the top of the file.
    #        listen          8080;
    save and exit
  4. Remove the default NGINX configuration.
    sudo rm /etc/nginx/sites-enabled/default
  5. Restart all of our services so that the configuration changes take effect.
    sudo systemctl restart zabbix-server zabbix-agent nginx php7.4-fpm

Now that we have set up NGINX, MySQL, and the Zabbix server, we can finally load its web interface.
You can use any web browser to access your Pi’s Zabbix server. You will only need to know your Pi’s local IP address.
hostname -I
With your Pi’s IP address, go to the following address in your web browser.
http://[IPADDRESS]

Conclusion

You should have successfully installed the Zabbix monitoring software on your Brainy Pi.
You can use Zabbix to monitor various things, including your Brainy Pi’s CPU load and network utilization.
0 Comments

Leave a reply

Your email address will not be published. Required fields are marked *

*