There is two modes for Zabbix checks:
- Passive check : a simple data request. Zabbix server or proxy asks for some data (for example, CPU load) and Zabbix agent sends back the result to the server.
- Active check : the agent must first retrieve from the server(s) a list of items for independent processing. Then the agent then periodically sends the new values to the server(s).
Monitoring a Zabbix agent behind a firewall or a NAT without any port redirection requires to use the active mode.
It’s not recommended to monitor over internet without using a VPN.
Zabbix server
Install a Zabbix server.
Zabbix agent
Hardware : Raspberry Pi OS : Linux OSMC
Once the server is ready, we can start to install our new agent, the one that is behind the NAT or Firewall.
Install :
sudo apt-get install zabbix-agent
Edit the configuration :
vi /etc/zabbix/zabbix_agentd.conf
And change the following :
Server=X.X.X.X
ServerActive=X.X.X.X#IP for active checks
Hostname=OSMC #Use the same hostname (case-sensitive) when declaring the host on the web UI
StartAgents=0 #Disable passive checks
Replace X.X.X.X by the IP of your Zabbix server.
Start the Zabbix agent service :
sudo service zabbix-agent restart
And check that everything went fine :
tail -f /var/log/zabbix-agent/zabbix_agentd.log
Host configuration
Prepare the template
We will clone the “Template OS Linux” and create a “Template OS Linux Active” that will use the active checks instead of passive modes.
01- Click on “Configuration” 02- Click on “Templates” 03- Click on “Template OS Linux” 04- Click on “Full Clone” (bottom) 05- Name the clone “Template OS Linux Active” 06- Click on “Add” (bottom) 07- Click on the “Template OS Linux Active” we’ve just created 08- Click on “Items” 09- Tick the upper-left to select all items 10- Scrolldown to the dropdown and select “Mass Update” and click “Go” 11- Tick “Type” 12- Change the value from “Zabbix agent” to “Zabbix agent (active)”
Create a new host
Create a new host :
- The hostname must match the one defined in the agent configuration (here : OSMC)
- As there is no IP to reach the agent, use IP : 0.0.0.0 and port : 0.
- Use the template we’ve just created (Template OS Linux Active).