Scheduled Reporting

In Zabbix, scheduled reports can be generated and sent automatically using Zabbix’s media types and user macros. While Zabbix doesn’t natively support scheduled reporting in the same way as other tools, you can achieve automated reports via certain steps.

First, you need to install the zabbix-web-service installation package from the official Zabbix repository:

sudo apt install zabbix-web-service -y

Next, installing Google Chrome.

This is the browser recommended by Zabbix for these purposes, but it can also be replaced with, for example, Chromium or Firefox.

https://www.google.com/chrome/what-you-make-of-it/

We will be downloading the *.deb package and then install it using command

sudo dpkg -i google-chrome-stable_current_amd64.deb

Once the google chrome package is installed we will face some dependency errors and we can fix it using

sudo apt --fix-broken install
sudo apt update

Now we wil pass the following commands to ensure google chrome is in the$PATH variable and operational with zabbix dependencies

export PATH=$PATH:/usr/bin/google-chrome-stable
source ~/.bashrc
sudo mkdir -p /var/lib/zabbix
sudo chown zabbix:zabbix /var/lib/zabbix
sudo mkdir -p /var/lib/zabbix/.local/share/applications
sudo touch /var/lib/zabbix/.local/share/applications/mimeapps.list
sudo chown zabbix:zabbix /var/lib/zabbix/.local/share/applications/mimeapps.list
mkdir -p /home/<USERNAME>/crash
google-chrome-stable --crashpad-handler --database=/home/<USERNAME>/crash --no-sandbox

Now we will edit the zabbix web service config file

sudo nano /etc/zabbix/zabbix_web_service.conf
### Option: AllowedIP
# List of comma delimited IP addresses, optionally in CIDR notation, or DNS names of Zabbix servers and
# Zabbix proxies.
# Example: AllowedIP=127.0.0.1,192.168.1.0/24,::1,2001:db8::/32,zabbix.example.com
#
# Mandatory: yes
# Default:
# AllowedIP=
AllowedIP=127.0.0.1,::1

And we will enable the report workers in the zabbix server config files located at

sudo nano /etc/zabbix/zabbix-server.conf
...
StartReportWriters=5
...
WebServiceURL=http://localhost:10053/report
...

When the configuration is complete, you can restart the reporting service and enable it to start automatically after startup:

systemctl restart zabbix-server.service
systemctl enable zabbix-web-service.service --now

You can do this by selecting the Reports -> Scheduled reports menu and clicking the Create report button there.

where the subject & Message fields are :

Subject : 
Weekly demo report From {{TIME}.fmttime(%d %B,-1w/w)} to {{TIME}.fmttime(%d %B %Y,-1w/w+6d)}
Message : 
<b>Week from {{TIME}.fmttime(%d/%m/%y,-1w/w)} to {{TIME}.fmttime(%d/%m/%y,-1w/w+6d)}</b><br>
Week from {{TIME}.fmttime(%d/%B/%Y,-1w/w)} to {{TIME}.fmttime(%d/%B/%Y,-1w/w+6d)}<br>
Week number {{TIME}.fmttime(%W,-1w/w)}<br>

Upon testing we can get the sample alert on email

Last updated