Zabbix启用计划报表

安装配置步骤

安装Zabbix Web Service
使用源码包编译安装,增加编译参数-enable-webservice

安装完成后尝试启动zabbix_web_service,使用以下命令,启动成功后本地会开启TCP 10053端口
/usr/local/zabbix/sbin/zabbix_web_service -c /etc/zabbix/zabbix_web_service.conf

使用以下命令,在后台运行zabbix_web_service,可以使用Cron设置自启
/usr/local/zabbix/sbin/zabbix_web_service -c /etc/zabbix/zabbix_web_service.conf > /dev/null 2>&1 &

安装Google Chrome
https://www.google.com/chrome/?platform=linux
下载安装包进行安装

缺少Google Chrome,发送报表会报错Cannot fetch data: exec: "google-chrome": executable file not found in $PATH

修改Zabbix Server配置
修改Zabbix Server配置文件zabbix_server.conf,启用以下配置,然后重启Zabbix Server服务

WebServiceURL=
WebServiceURL=

修改前端配置
网页端:管理->常规->其他->前端网址,填入实际的前端访问地址

注意事项
计划报表通过邮件进行发送,如果接收人未配置邮件告警媒介,测试发送会出现“No media configured for the report recipients”错误

相关问题处理

一、编译报错:Unable to find "go" executable in path

需要安装Go 1.13以上版本
1. 从https://go.dev/doc/install下载软件包

2. 删除现有的Go,如果使用包管理器安装,先进行删除

3. 删除现有的/usr/local/go,并将下载的软件包解压到/usr/local/go
官方命令(可在下载页面看到)
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.22.6.linux-amd64.tar.gz

4. 设置系统变量export PATH=$PATH:/usr/local/go/bin

5. 执行go version,确认版本正确

二、编译报错:is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod

具体报错如下

go: inconsistent vendoring in /root/zabbix-7.0.2/src/go:
    github.com/chromedp/sysutil@v1.0.0: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
    github.com/go-logfmt/logfmt@v0.5.1: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
    github.com/go-logr/logr@v1.2.3: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
    github.com/gobwas/httphead@v0.1.0: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
    github.com/gobwas/pool@v0.2.1: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
    github.com/gobwas/ws@v1.1.0: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
    github.com/godror/knownpb@v0.1.0: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
    github.com/gorilla/websocket@v1.4.2: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
    github.com/josharian/intern@v1.0.0: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
    github.com/mailru/easyjson@v0.7.7: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
    golang.org/x/mod@v0.12.0: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
    golang.org/x/sync@v0.3.0: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
    golang.org/x/tools@v0.11.0: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod

    To ignore the vendor directory, use -mod=readonly or -mod=mod.
    To sync the vendor directory, run:
        go mod vendor

1. 进入Zabbix源码包/src/go目录,例如zabbix-7.0.2/src/go

2. 执行命令go mod vendor

  • 如果go mod vendor完成后提示

    go: updates to go.mod needed; to update it:
      go mod tidy

    继续执行go mod tidy

  • 如果go mod tidy报错,提示“dial tcp i/o timeout”,需要配置GOPROXY,使用以下命令配置国内代理
    1、阿里代理
    go env -w GOPROXY=https://mirrors.aliyun.com/goproxy,direct
    2、七牛云代理
    go env -w GOPROXY=https://goproxy.cn,direct

3. 再次编译安装zabbix_web_service

三、安装Google Chrome提示缺少依赖组件

1. 强制安装Google Chrome
dpkg -i --force depends google-chrome-stable_current_amd64.deb

2. Google Chrome安装完成后会提示“Error: Could not find xdg-icon-resource”
使用命令安装apt install xdg-utils,安装过程中会报错,提示google-chrome-stable缺少依赖组件,具体内容如下

You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 google-chrome-stable : Depends: fonts-liberation but it is not going to be installed
                        Depends: libasound2 (>= 1.0.17) but it is not going to be installed
                        Depends: libatk-bridge2.0-0 (>= 2.5.3) but it is not going to be installed
                        Depends: libatk1.0-0 (>= 2.2.0) but it is not going to be installed
                        Depends: libatspi2.0-0 (>= 2.9.90) but it is not going to be installed
                        Depends: libcairo2 (>= 1.6.0) but it is not going to be installed
                        Depends: libcups2 (>= 1.7.0) but it is not going to be installed
                        Depends: libdrm2 (>= 2.4.75) but it is not going to be installed
                        Depends: libgbm1 (>= 17.1.0~rc2) but it is not going to be installed
                        Depends: libgtk-3-0 (>= 3.9.10) but it is not going to be installed or
                                 libgtk-4-1 but it is not installable
                        Depends: libnspr4 (>= 2:4.9-2~) but it is not going to be installed
                        Depends: libnss3 (>= 2:3.35) but it is not going to be installed
                        Depends: libpango-1.0-0 (>= 1.14.0) but it is not going to be installed
                        Depends: libu2f-udev but it is not going to be installed
                        Depends: libvulkan1 but it is not going to be installed
                        Depends: libxcomposite1 (>= 1:0.4.4-1) but it is not going to be installed
                        Depends: libxdamage1 (>= 1:1.1) but it is not going to be installed
                        Depends: libxfixes3 but it is not going to be installed
                        Depends: libxkbcommon0 (>= 0.5.0) but it is not going to be installed
                        Depends: libxrandr2 but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

使用命令apt --fix-broken install安装缺少的组件,完成后再次执行apt install xdg-utils进行安装

来源:
https://www.zabbix.com/documentation/current/zh/manual/appendix/install/web_service

https://www.zabbix.com/documentation/current/zh/manual/appendix/config/zabbix_web_service

https://www.zabbix.com/documentation/current/zh/manual/installation/install#%E5%AE%89%E8%A3%85Zabbix-web%E6%9C%8D%E5%8A%A1

https://go.dev/doc/install