Jump to content

Monitoring via Zabbix: Difference between revisions

m
no edit summary
mNo edit summary
mNo edit summary
Line 17: Line 17:
There are several ways to install the Zabbix server, depending on your operating system and environment. Here are a few common methods:
There are several ways to install the Zabbix server, depending on your operating system and environment. Here are a few common methods:


*Package manager: On Linux distributions such as Red Hat, CentOS, Debian, and Ubuntu, you can install the Zabbix server using the package manager. This is the easiest and most common way to install Zabbix. For example, on Ubuntu, you can use the command: sudo apt-get install zabbix-server-mysql zabbix-frontend-php
*'''Package manager:''' On Linux distributions such as Red Hat, CentOS, Debian, and Ubuntu, you can install the Zabbix server using the package manager. This is the easiest and most common way to install Zabbix. For example, on Ubuntu, you can use the command: ''sudo apt-get install zabbix-server-mysql zabbix-frontend-php''
*Source installation: You can also install Zabbix from the source code. This method allows you to customize your installation and install the latest version of Zabbix. You will need to download the source code from the Zabbix website, and then compile and install it on your system.
*'''Source installation:''' You can also install Zabbix from the source code. This method allows you to customize your installation and install the latest version of Zabbix. You will need to download the source code from the Zabbix website, and then compile and install it on your system.
*Docker: Zabbix has an official Docker image, which allows you to run the Zabbix server in a container. This is a useful option for testing or for environments where you want to minimize the number of installed packages on the host system.
*'''Docker:''' Zabbix has an official Docker image, which allows you to run the Zabbix server in a container. This is a useful option for testing or for environments where you want to minimize the number of installed packages on the host system.
*Virtual Appliance: Zabbix also provides ready to use Virtual Appliance with the pre-installed Zabbix server. This can be used in environments such as VMware or VirtualBox.
*'''Virtual Appliance:''' Zabbix also provides ready to use Virtual Appliance with the pre-installed Zabbix server. This can be used in environments such as VMware or VirtualBox.
*Cloud Image: Zabbix also provides pre-configured image for different cloud provider like AWS,Azure,GCP. This can be used to quickly deploy Zabbix monitoring on cloud environments.
*'''Cloud Image:''' Zabbix also provides pre-configured image for different cloud provider like AWS,Azure,GCP. This can be used to quickly deploy Zabbix monitoring on cloud environments.


No matter which method you choose, you will also need to set up a database for the Zabbix server to use, and configure the PHP frontend for the web interface. The specific steps for these tasks will vary depending on your operating system and environment, but you can find detailed instructions in the Zabbix documentation.
No matter which method you choose, you will also need to set up a database for the Zabbix server to use, and configure the PHP front-end for the web interface. The specific steps for these tasks will vary depending on your operating system and environment, but you can find detailed instructions in the Zabbix documentation.


In this example, we have Zabbix server set up using Docker container method and PostgreSQL database on Windows 10 + WSL Ubuntu 22.04 LTS. Instructions can be found in official Zabbix documentation:  
 
In this example, we have Zabbix server set up using Docker container method and PostgreSQL database on '''Windows 10 + WSL Ubuntu 22.04 LTS'''. Instructions can be found in official Zabbix documentation:  
https://www.zabbix.com/documentation/current/en/manual/installation/containers
https://www.zabbix.com/documentation/current/en/manual/installation/containers


Once Zabbix server is up and running, we can start adding Hosts.
Once Zabbix server is up and running, we can start adding Hosts.
==Monitoring Using Agent==
The Zabbix agent is a small program that runs on the hosts that you want to monitor. Its role is to collect various data from the host, such as performance metrics, log files, and system information, and then send this data to the Zabbix server. This allows the server to analyze the data and create alerts, graphs, and reports based on it.
The Zabbix agent is typically installed on the same machine as the Zabbix server, but it can also be installed on remote hosts, such as servers, workstations, or network devices. It can run on a wide variety of platforms, including Linux, Windows, macOS, and even embedded systems.
In this example, Zabbix agent will be installed as a package on the RutOS operating system.
===Installing and Configuring Zabbix Agent===
In order to install Zabbix agent on our router, we will need to access the Command Line Interface. Refer to the following article to find our how:
https://wiki.teltonika-networks.com/view/Command_Line_Interfaces_RutOS
Once in CLI, execute the following commands in order to install the agent daemon:
<pre>
opkg update
opkg install zabbix-agentd
</pre>
Next, use your favourite editor to open the configuration file:
<pre>
nano /etc/zabbix_agentd.conf
</pre>
Once we have zabbix_agentd.conf opened, we will need to change the "Server" value and set it to the IP address of the Zabbix server:
<pre>
Server=192.168.1.220
</pre>
Additionally, add ListenPort and Hostname values:
<pre>
ListenPort=10050
Hostname=RUTX11
</pre>
'''Note:''' We are listening on port 10050 because '''passive''' agent is used in this example, if you wish to use '''active''' agent, 10051 port should be used.
Save the changes in the configuration file and restart the daemon:
<pre>
/etc/init.d/zabbix-agentd restart
</pre>
===Adding Agent Host to Zabbix front-end===
Once we have agent set-up on the router, we will add it as host in the zabbix server. In order to do so