> For the complete documentation index, see [llms.txt](https://ghoulsec.gitbook.io/ghoulsec-vault/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ghoulsec.gitbook.io/ghoulsec-vault/security-operations/zabbix-nms/scheduled-reporting.md).

# 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.

{% hint style="info" %}
<https://www.zabbix.com/documentation/current/en/manual/config/reports>
{% endhint %}

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

```bash
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.

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

We will be downloading the `*.deb` package and then install it using command&#x20;

```bash
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&#x20;

```bash
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

```bash
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&#x20;

```bash
sudo nano /etc/zabbix/zabbix_web_service.conf
```

```bash
### 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&#x20;

```bash
sudo nano /etc/zabbix/zabbix-server.conf
```

```bash
...
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:

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

<figure><img src="https://2332860236-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fq6mjlFfyDOi3mV0lemKE%2Fuploads%2FQaO95di8ZYSpHVfbQ1c6%2Fimage.png?alt=media&amp;token=7d0b39b9-637b-4192-8b76-076a49294343" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://2332860236-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fq6mjlFfyDOi3mV0lemKE%2Fuploads%2FZtLDniNufEmAa8z6Drbu%2Fimage.png?alt=media&amp;token=1a76c9f7-8e33-4707-a5d5-594980dc8466" alt=""><figcaption></figcaption></figure>

where the subject & Message fields are :&#x20;

```bash
Subject : 
Weekly demo report From {{TIME}.fmttime(%d %B,-1w/w)} to {{TIME}.fmttime(%d %B %Y,-1w/w+6d)}
```

```bash
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&#x20;

<figure><img src="https://2332860236-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fq6mjlFfyDOi3mV0lemKE%2Fuploads%2FFXXW9ocFuKYXTq0v3D16%2Fimage.png?alt=media&amp;token=1eb7bb70-4db6-4e40-8795-3d3157f00fab" alt=""><figcaption></figcaption></figure>
