Debian Codegraph @

ansible_collections/community/zabbix/roles/zabbix_web_service/README.md

raw
1 # Zabbix Web Service Role
2
3 This role installs and configures the Zabbix Web Service, a component used for generating scheduled reports in Zabbix.
4
5 ## Table of Contents
6
7 * [Official Documentation](#official-documentation)
8 * [Requirements](#requirements)
9 * [Google Chrome](#google-chrome)
10 * [Target OS](#target-os)
11 * [Ansible](#ansible)
12 * [Role Variables](#role-variables)
13 * [Main Variables](#main-variables)
14 * [Configuration Variables](#configuration-variables)
15 * [API Variables (Frontend URL Setup)](#api-variables-frontend-url-setup)
16 * [Integration with Zabbix Server](#integration-with-zabbix-server)
17 * [Dependencies](#dependencies)
18 * [Example Playbook](#example-playbook)
19 * [License](#license)
20 * [Author Information](#author-information)
21
22 ## Official Documentation
23
24 For more detailed information about the Zabbix Web Service and its usage, please refer to the official Zabbix documentation:
25 * [Zabbix Web Service Concept](https://www.zabbix.com/documentation/current/en/manual/concepts/web_service): Detailed explanation of what the Zabbix web service is, its architecture, and how it works.
26 * [Scheduled Reports Configuration](https://www.zabbix.com/documentation/current/en/manual/config/reports): A comprehensive guide on how to configure, schedule, and manage reports directly within the Zabbix frontend.
27 * [Setting up Zabbix Web Service](https://www.zabbix.com/documentation/current/en/manual/appendix/install/web_service): Instructions and requirements for setting up the web service, including Google Chrome and font dependencies.
28 * [Zabbix Web Service Configuration Parameters](https://www.zabbix.com/documentation/current/en/manual/appendix/config/zabbix_web_service): Details all available configuration parameters for the `zabbix_web_service.conf` file.
29
30 ## Requirements
31
32 ### Google Chrome
33 Google Chrome is required for the report generation.
34 Example sources:
35 * EL family/Suse: https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
36 * Debian: https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
37
38
39 ### Target OS
40 This role has been **tested** and verified on:
41 * Enterprise Linux (EL) 8, 9, 10 family (RHEL, AlmaLinux, Rocky Linux, Oracle Linux)
42
43 The following operating systems are supported by the role's logic, but are currently **untested** (contributions and test reports are welcome):
44 * CentOS 8, 9 (Stream)
45 * Debian 11, 12
46 * Ubuntu 20.04, 22.04, 24.04
47 * SUSE Linux Enterprise Server (SLES)
48
49 ### Ansible
50 * Ansible 2.10+
51
52 ## Role Variables
53
54 ### Main Variables
55
56 | Variable | Default | Description |
57 |----------|---------|-------------|
58 | `zabbix_web_service_version_check` | `true` | Enables validation to ensure the specified Zabbix version is supported on the target OS. |
59 | `zabbix_web_service_version` | `7.4` (depends on OS) | The Zabbix version to install. |
60 | `zabbix_manage_repo` | `true` | When set to `true`, the `community.zabbix.zabbix_repo` role will be included to install the Zabbix repository. |
61 | `zabbix_os_user` | `zabbix` | The OS user that runs the Zabbix Web Service and owns its directories. |
62 | `zabbix_service_enabled` | `true` | Enables the `zabbix-web-service` systemd service to start on boot. |
63 | `zabbix_service_state` | `started` | The state of the `zabbix-web-service` service. |
64 | `zabbix_web_service_manage_service` | `true` | When set to `true`, the role will manage the service state. |
65 | `selinux_allow_zabbix_can_network` | `true` | When set to `true` and SELinux is enabled, sets the `zabbix_can_network` boolean. |
66 | `zabbix_web_service_packages` | `{{ _zabbix_web_service_packages }}` | List of packages to install for the web service. |
67 | `zabbix_web_service_package_state` | `present` | State of the installed packages (e.g., `present`, `latest`). |
68
69 ### Configuration Variables
70
71 These variables map directly to the parameters in `/etc/zabbix/zabbix_web_service.conf`.
72
73 | Variable | Default | Description |
74 |----------|---------|-------------|
75 | `zabbix_web_service_logtype` | `file` | Specifies where log messages are written to (`system`, `file`, `console`). |
76 | `zabbix_web_service_logfile` | `/var/log/zabbix/zabbix_web_service.log` | Log file name for LogType `file`. |
77 | `zabbix_web_service_logfilesize` | `0` | Maximum size of log file in MB. `0` disables automatic log rotation. |
78 | `zabbix_web_service_debuglevel` | *None* | Specifies debug level (0-5). |
79 | `zabbix_web_service_allowedip` | *None* | List of comma-delimited IP addresses allowed to connect to the service. **(Mandatory for service to work)** |
80 | `zabbix_web_service_listenport` | *None* | Service will listen on this port for connections from the server (Default: 10053). |
81 | `zabbix_web_service_timeout` | *None* | Spend no more than Timeout seconds on formatting dashboard as PDF. |
82 | `zabbix_web_service_tlsaccept` | *None* | What incoming connections to accept (`unencrypted`, `cert`). |
83 | `zabbix_web_service_tlscafile` | *None* | Full pathname of a file containing the top-level CA(s) certificates. |
84 | `zabbix_web_service_tlscertfile` | *None* | Full pathname of a file containing the service certificate or certificate chain. |
85 | `zabbix_web_service_tlskeyfile` | *None* | Full pathname of a file containing the service private key. |
86
87 ### API Variables (Frontend URL Setup)
88
89 To automatically configure the `Frontend URL` parameter in Zabbix global settings (required for the web service to fetch dashboards), the following variables can be used:
90
91 | Variable | Default | Description |
92 |----------|---------|-------------|
93 | `zabbix_api_frontend_url` | `false` | Set to `true` to enable setting the Frontend URL via Zabbix API. |
94 | `zabbix_frontend_url` | *None* | The actual URL of the Zabbix frontend (e.g., `https://zabbix.example.com/zabbix`). |
95 | `zabbix_api_server_host` | *None* | The hostname or IP of the Zabbix API server. |
96 | `zabbix_api_server_port` | *None* | The port of the Zabbix API. |
97 | `zabbix_api_use_ssl` | *None* | Use SSL/HTTPS for API connection. |
98 | `zabbix_api_validate_certs` | *None* | Validate SSL certificates. |
99 | `zabbix_api_login_user` | *None* | Zabbix API username. |
100 | `zabbix_api_login_pass` | *None* | Zabbix API password. |
101
102 ## Integration with Zabbix Server
103
104 For the Zabbix Web Service to function properly and generate scheduled reports, the Zabbix Server **must** be configured to communicate with it.
105
106 If the Zabbix Server is managed using the `community.zabbix.zabbix_server` role, please refer to the [ZABBIX_SERVER_ROLE.md](ZABBIX_SERVER_ROLE.md) documentation. At least the following two variables must be set in the Zabbix Server configuration:
107
108 * `zabbix_server_webserviceurl`: The URL to the Zabbix Web Service (e.g., `http://localhost:10053/report`).
109 * `zabbix_server_startreportwriters`: The number of pre-forked report writer instances (must be set to `1` or higher).
110
111 ## Dependencies
112
113 * `community.zabbix.zabbix_repo` (Included automatically if `zabbix_manage_repo` is `true`)
114
115 ## Example Playbook
116
117 ```yaml
118 - name: Install and configure Zabbix Web Service
119 hosts: zabbix_web_service
120 become: true
121 vars:
122 zabbix_web_service_allowedip: "127.0.0.1,192.168.1.0/24"
123
124 # Optional: Automatically set the Frontend URL in Zabbix Server settings
125 zabbix_api_frontend_url: true
126 zabbix_frontend_url: "https://zabbix.example.com/zabbix"
127 zabbix_api_server_host: "127.0.0.1"
128 zabbix_api_login_user: "Admin"
129 zabbix_api_login_pass: "zabbix"
130
131 roles:
132 - role: community.zabbix.zabbix_web_service
133 ```
134
135 ## License
136
137 GNU General Public License v3.0 or later.
138
139 ## Author Information
140
141 This role was created and is maintained by the `community.zabbix` collection contributors.