Skip to main content

(一)zabbix-feishu-alert 模块使用方法

(一):安装

  • 从 PYPI 安装
pip install -U  zabbix-feishu-alert
  • 从 Github 安装
pip install git+https://github.com/yinhuanyi/zabbix-feishu-alert.git

(二):使用方法

from zabbix_feishu_alert import FeishuMessage

# 第一个参数:100.99.1.3为你的zabbix serverIP地址
# 第二个参数:Admin为你的zabbix web登录用户名
# 第三个参数:zabbix为你的zabbix web登录密码
# 第四个参数:13970236751为被@人的手机号码
# 第五个参数:36836为监控item的item id
# 第六个参数:zabbix graph存储路径
# 第七个参数:飞书机器人的app_id
# 第八个参数:飞书机器人的app_secret
feishu = FeishuMessage('100.99.1.3',
                       'Admin',
                       'zabbix',
                       '13970236751',
                       36836,
                       './',
                       'cli_9e44d8e26dbb500d',
                       '8X4jX9MLwg6AXIEVJh0lC8oeHNDBfbnd')

# 第一个和第二个参数为:发送告警信息的时候,需要获取到zabbix中的title信息和message信息
# 第三个参数:38524是此次告警的event_id
# 第四个参数:http://100.112.2.11:8000/monitor/problem_ack/是[立即处理]按钮发送ACK消息webhook的地址
feishu.send_alarm_message("Zabbix Alert Title",
                          "Zabbix Alert Content",
                          38524,
                          'http://100.112.2.11:8000/monitor/problem_ack/')

# 发送确认告警消息
feishu.send_ack_message("Zabbix Ack Title", 
                        "Zabbix Content Title")

# 发送恢复告警消息
feishu.send_recovery_message("Zabbix Recovery Title", 
                             "Zabbix Content Title")

(三):告警效果

  • 测试效果

alert_test

  • 真实接入zabbix之后的效果

alert_message

(四):点击[立即处理]按钮

  • 当值班人被@后,需要点击立即处理,立即处理会跳转到企业内部的运维平台,记录告警人的基本信息,例如:姓名,处理告警的时间等

alert_ack_manager

(二)飞书机器人的创建

(一):登录飞书开放平台

  • 登录飞书开放

飞书开放平台

  • 在我的应用中,点击创建企业自建应用

  • 在应用凭证栏中,可以看到APP ID和App Secret

feishu_app

欢迎提交PR

Release files for zabbix-feishu-alert 1.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zabbix-feishu-alert 1.0.8
File Size Uploaded
zabbix-feishu-alert-1.0.8.tar.gz 154.5 kB Details

Release files / zabbix-feishu-alert-1.0.8.tar.gz

Download URL zabbix-feishu-alert-1.0.8.tar.gz
Size 154.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1fb90915594f799f27687fce6f495d12c36477bfe4275ac681081e97fb229f49
BLAKE2b-256 checksum
How to use checksums
09f4a0ab4460dc6b3fac92406b112015b1c85373db0d55e07c69c25876e79bd8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.3

Release history Release notifications | RSS feed

This release

1.0.8 This release

1 release file

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page