zabbix 不能在web页面显示,无法加载。非一般原因(配置的大意也可导致出错,一定注意细节)

首先查看sever日志cat /var/log/zabbix/zabbix_server.log

2352:20190720:164019.953 server #7 started [history syncer #2]
  2353:20190720:164019.954 server #8 started [history syncer #3]
  2354:20190720:164019.954 server #9 started [history syncer #4]
  2357:20190720:164019.955 server #12 started [self-monitoring #1]
  2362:20190720:164019.955 server #17 started [poller #4]
  2364:20190720:164019.966 server #19 started [unreachable poller #1]
  2367:20190720:164019.977 server #22 started [trapper #3]
  2372:20190720:164019.979 server #27 started [alerter #1]
  2373:20190720:164019.979 server #28 started [alerter #2]
  2375:20190720:164019.979 server #30 started [preprocessing manager #1]
  2350:20190720:164019.980 server #5 started [discoverer #1]
  2356:20190720:164019.991 server #11 started [proxy poller #1]
  2346:20190720:164019.992 server #1 started [configuration syncer #1]
  2365:20190720:164019.993 server #20 started [trapper #1]
  2376:20190720:164020.098 server #31 started [preprocessing worker #1]
  2378:20190720:164020.136 server #33 started [preprocessing worker #3]
  2377:20190720:164020.151 server #32 started [preprocessing worker #2]
发现启动正常,没有问题,接着查看客户端日志

cat /var/log/zabbix/zabbix_agentd.log

  2336:20190720:164338.941 Got signal [signal:15(SIGTERM),sender_pid:2478
,sender_uid:0,reason:0]. Exiting ...  2336:20190720:164338.945 Zabbix Agent stopped. Zabbix 4.2.4 (revision 0
59af02c82).  2484:20190720:164339.029 Starting Zabbix Agent [Zabbix server]. Zabbix 
4.2.4 (revision 059af02c82).  2484:20190720:164339.029 **** Enabled features ****
  2484:20190720:164339.029 IPv6 support:          YES
  2484:20190720:164339.029 TLS support:           YES
  2484:20190720:164339.029 **************************
  2484:20190720:164339.029 using configuration file: /etc/zabbix/zabbix_a
gentd.conf  2484:20190720:164339.029 agent #0 started [main process]
  2487:20190720:164339.031 agent #3 started [listener #2]
  2488:20190720:164339.033 agent #4 started [listener #3]
  2485:20190720:164339.035 agent #1 started [collector]
  2486:20190720:164339.036 agent #2 started [listener #1]

时间最近的 发现一个错误:“

获取信号[信号:15(sigterm),发送方PID:2478

,发件人Uid:0,原因:0]。正在退出…”

原因:
1、防火墙开启
2、自定义配置文件不对的原因

于是先试着关一下防火墙和seLinux

[root@xiaob doc]# systemctl stop firewalld
[root@xiaob doc]# cat /etc/selinux/config 

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes 
are protected. #     mls - Multi Level Security protection.
SELINUXTYPE=targeted 
 

B机器

[root@xiaoa ~]# systemctl stop firewalld
[root@xiaoa ~]# cat /etc/selinux/config 

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes 
are protected. #     mls - Multi Level Security protection.
SELINUXTYPE=targeted 

结果防火墙没关

一刷新网页就加载出来了---真尴尬。。。。

小插曲出现active check configuration update from [127.0.0.1:10051]

直接编辑zabbix_agentd.conf注释掉ServerActive=127.0.0.1即可。
 

### ### Zabbix 配置 Web 页面监控步骤指南 在 Zabbix配置 Web 页面监控主要涉及创建 Web 场景、定义监控步骤以及设置触发器来实现对网页状态的持续监测。以下是详细的配置流程: #### 创建 Web 监控模板 首先,需要为 Web 监控创建一个模板,该模板将包含所有与 Web 页面监控相关的监控项和触发器[^5]。 1. 登录到 Zabbix Web 界面。 2. 导航至 **Configuration > Templates**。 3. 点击右上角的 **Create template** 按钮。 4. 输入模板名称,并选择适当的群组。 5. 保存模板。 #### 添加 Web 场景 Web 场景允许模拟用户访问 Web 站点的行为,可以用来检查网站是否可用或响应时间是否符合预期[^5]。 1. 在模板页面中,找到 **Web scenarios** 标签页并点击 **Create web scenario**。 2. 填写场景名称,设定更新间隔时间和尝试次数。 3. 点击 **Steps** 标签页下的 **Add** 按钮来添加新的监控步骤。 4. 对于每一个步骤,输入名称、请求的 URL 地址、超时时间以及期望的状态码(例如 200 表示成功响应)。 5. 完成后点击 **Update** 保存更改。 #### 设置触发器 为了能够在 Web 页面出现问题时收到通知,需要创建触发器来检测异常情况。 1. 转到 **Triggers** 标签页并点击 **Create trigger**。 2. 输入触发器名称。 3. 使用表达式构建器添加一个表达式,比如选择 `Response code` 开头的选项。 4. 设定功能与结果,如当响应状态码不等于 200 时触发告警。 5. 保存触发器。 #### 主机配置 确保目标 Web 服务器已经正确配置Zabbix Agent,并且可以从 Zabbix Server 访问。 - 在 Zabbix Web 界面中添加主机,并关联之前创建的 Web 监控模板。 - 如果使用的是自定义脚本进行更复杂的监控,则需在 `/etc/zabbix/zabbix_agentd.conf` 文件中启用 `UnsafeUserParameters=1` 并配置相应的 `UserParameter` 指向脚本路径[^1]。 #### 测试与验证 最后一步是测试整个配置以确认一切正常工作。 - 可以手动执行 `zabbix_get` 命令来测试 Agent 返回值。 - 查看 Zabbix Server 和 Agent 的日志文件,寻找任何可能的错误信息。 - 在 Zabbix Web 界面上查看最新数据,确保能够看到最新的监控结果。 通过上述步骤,可以在 Zabbix 中完成对特定 Web 页面的有效监控。这不仅有助于及时发现服务中断或性能下降的问题,还能提供历史数据用于分析趋势。 ```bash # 示例:使用curl命令获取网页状态码的脚本 #!/bin/bash URL="http://example.com/page" STATUS_CODE=$(curl -s --max-time 10 -o /dev/null -w "%{http_code}" $URL) echo $STATUS_CODE ```
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值