zabbix

为企业基础设施监控配置 Zabbix,包括模板、触发器、发现规则和仪表板;用于设置 Zabbix 服务器、配置主机监控、创建自定义模板、定义触发器表达式以及自动化主机发现和注册。

仓库最近推送
GitHub Stars
219
Forks
38
Issues / PRs
1

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "zabbix":https://skillpi.com/zh/skills/deepskill-b85f1e0c003fd30094ab217750bda54c9b434dae930e54e6fe0e5350b2299955。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

为企业基础设施监控配置 Zabbix,包括模板、触发器、发现规则和仪表板;用于设置 Zabbix 服务器、配置主机监控、创建自定义模板、定义触发器表达式以及自动化主机发现和注册。

0 下载

介绍来源: third_party · TerminalSkills · 1.0.0 参考来源

SkillPi 解读

实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: zabbix
description: >-
  Configure Zabbix for enterprise infrastructure monitoring with templates,
  triggers, discovery rules, and dashboards. Use when a user needs to set up
  Zabbix server, configure host monitoring, create custom templates, define
  trigger expressions, or automate host discovery and registration.
license: Apache-2.0
compatibility: "Zabbix 6.4+, Zabbix Agent 2"
metadata:
  author: terminal-skills
  version: "1.0.0"
  category: devops
  tags: ["zabbix", "enterprise-monitoring", "templates", "triggers", "discovery"]

Zabbix

Overview

Set up Zabbix for enterprise monitoring with host configuration, templates, trigger expressions, low-level discovery, and API automation. Covers server deployment, agent setup, and dashboard creation.

Instructions

Task A: Deploy Zabbix Server

# docker-compose.yml — Zabbix server with PostgreSQL and web frontend
services:
  zabbix-server:
    image: zabbix/zabbix-server-pgsql:6.4-ubuntu-latest
    environment:
      - DB_SERVER_HOST=postgres
      - POSTGRES_USER=zabbix
      - POSTGRES_PASSWORD=zabbix_password
      - POSTGRES_DB=zabbix
      - ZBX_CACHESIZE=128M
      - ZBX_HISTORYCACHESIZE=64M
      - ZBX_TRENDCACHESIZE=32M
    ports:
      - "10051:10051"
    depends_on:
      - postgres

  zabbix-web:
    image: zabbix/zabbix-web-nginx-pgsql:6.4-ubuntu-latest
    environment:
      - DB_SERVER_HOST=postgres
      - POSTGRES_USER=zabbix
      - POSTGRES_PASSWORD=zabbix_password
      - POSTGRES_DB=zabbix
      - ZBX_SERVER_HOST=zabbix-server
      - PHP_TZ=America/New_York
    ports:
      - "8080:8080"

  postgres:
    image: postgres:16-alpine
    environment:
      - POSTGRES_USER=zabbix
      - POSTGRES_PASSWORD=zabbix_password
      - POSTGRES_DB=zabbix
    volumes:
      - pg_data:/var/lib/postgresql/data

volumes:
  pg_data:

Task B: Install and Configure Zabbix Agent 2

# Install Zabbix Agent 2 on Ubuntu
wget https://repo.zabbix.com/zabbix/6.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.4-1+ubuntu22.04_all.deb
sudo dpkg -i zabbix-release_6.4-1+ubuntu22.04_all.deb
sudo apt-get update
sudo apt-get install -y zabbix-agent2 zabbix-agent2-plugin-*
# /etc/zabbix/zabbix_agent2.conf — Agent 2 configuration
Server=192.168.1.5
ServerActive=192.168.1.5
Hostname=web-01.production
HostMetadata=linux:web:production:ubuntu
ListenPort=10050
Timeout=10

Plugins.SystemRun.LogRemoteCommands=1

# Enable PostgreSQL monitoring plugin
Plugins.PostgreSQL.Sessions.mydb.Uri=tcp://localhost:5432
Plugins.PostgreSQL.Sessions.mydb.User=zbx_monitor
Plugins.PostgreSQL.Sessions.mydb.Password=monitor_password

Task C: Create Custom Templates via API

# Authenticate and get token
AUTH_TOKEN=$(curl -s "http://localhost:8080/api_jsonrpc.php" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "user.login",
    "params": { "username": "Admin", "password": "zabbix" },
    "id": 1
  }' | jq -r '.result')
# Create a custom template
curl -s "http://localhost:8080/api_jsonrpc.php" \
  -H "Content-Type: application/json" \
  -d "{
    \"jsonrpc\": \"2.0\",
    \"method\": \"template.create\",
    \"params\": {
      \"host\": \"Custom Web Application\",
      \"groups\": [{ \"groupid\": \"1\" }],
      \"description\": \"Monitors web application health, response times, and error rates\"
    },
    \"auth\": \"${AUTH_TOKEN}\",
    \"id\": 2
  }"
# Create items (metrics) on the template
curl -s "http://localhost:8080/api_jsonrpc.php" \
  -H "Content-Type: application/json" \
  -d "{
    \"jsonrpc\": \"2.0\",
    \"method\": \"item.create\",
    \"params\": [
      {
        \"name\": \"HTTP response time\",
        \"key_\": \"web.page.perf[https://app.example.com,,,443]\",
        \"hostid\": \"TEMPLATE_ID\",
        \"type\": 0,
        \"value_type\": 0,
        \"delay\": \"60s\",
        \"units\": \"s\",
        \"description\": \"Response time of the main application page\"
      },
      {
        \"name\": \"HTTP status code\",
        \"key_\": \"web.page.get[https://app.example.com,,,443]\",
        \"hostid\": \"TEMPLATE_ID\",
        \"type\": 0,
        \"value_type\": 3,
        \"delay\": \"60s\",
        \"preprocessing\": [
          { \"type\": \"REGEX\", \"params\": \"HTTP/[0-9.]+ ([0-9]+)\\n\\\\1\" }
        ]
      }
    ],
    \"auth\": \"${AUTH_TOKEN}\",
    \"id\": 3
  }"

Task D: Define Triggers

# Create trigger expressions via API
curl -s "http://localhost:8080/api_jsonrpc.php" \
  -H "Content-Type: application/json" \
  -d "{
    \"jsonrpc\": \"2.0\",
    \"method\": \"trigger.create\",
    \"params\": [
      {
        \"description\": \"High CPU usage on {HOST.NAME}\",
        \"expression\": \"avg(/Custom Web Application/system.cpu.util,5m)>85\",
        \"recovery_expression\": \"avg(/Custom Web Application/system.cpu.util,5m)<70\",
        \"priority\": 4,
        \"manual_close\": 1,
        \"tags\": [
          { \"tag\": \"scope\", \"value\": \"performance\" },
          { \"tag\": \"service\", \"value\": \"web\" }
        ]
      },
      {
        \"description\": \"Disk space critically low on {HOST.NAME}\",
        \"expression\": \"last(/Custom Web Application/vfs.fs.size[/,pfree])<10\",
        \"priority\": 5,
        \"tags\": [
          { \"tag\": \"scope\", \"value\": \"capacity\" }
        ]
      },
      {
        \"description\": \"HTTP response time too high on {HOST.NAME}\",
        \"expression\": \"avg(/Custom Web Application/web.page.perf[https://app.example.com,,,443],5m)>3\",
        \"priority\": 3,
        \"tags\": [
          { \"tag\": \"scope\", \"value\": \"availability\" }
        ]
      }
    ],
    \"auth\": \"${AUTH_TOKEN}\",
    \"id\": 4
  }"

Task E: Low-Level Discovery

# Create a discovery rule for Docker containers
curl -s "http://localhost:8080/api_jsonrpc.php" \
  -H "Content-Type: application/json" \
  -d "{
    \"jsonrpc\": \"2.0\",
    \"method\": \"discoveryrule.create\",
    \"params\": {
      \"name\": \"Docker container discovery\",
      \"key_\": \"docker.containers.discovery[true]\",
      \"hostid\": \"TEMPLATE_ID\",
      \"type\": 0,
      \"delay\": \"5m\",
      \"lifetime\": \"7d\"
    },
    \"auth\": \"${AUTH_TOKEN}\",
    \"id\": 5
  }"
# Create item prototypes for discovered containers
curl -s "http://localhost:8080/api_jsonrpc.php" \
  -H "Content-Type: application/json" \
  -d "{
    \"jsonrpc\": \"2.0\",
    \"method\": \"itemprototype.create\",
    \"params\": {
      \"name\": \"Container {#NAME}: CPU usage\",
      \"key_\": \"docker.container_info[{#NAME},cpu_percent]\",
      \"hostid\": \"TEMPLATE_ID\",
      \"ruleid\": \"DISCOVERY_RULE_ID\",
      \"type\": 0,
      \"value_type\": 0,
      \"delay\": \"30s\",
      \"units\": \"%\"
    },
    \"auth\": \"${AUTH_TOKEN}\",
    \"id\": 6
  }"

Task F: Auto-Registration

# Configure auto-registration action via API
curl -s "http://localhost:8080/api_jsonrpc.php" \
  -H "Content-Type: application/json" \
  -d "{
    \"jsonrpc\": \"2.0\",
    \"method\": \"action.create\",
    \"params\": {
      \"name\": \"Auto-register Linux web servers\",
      \"eventsource\": 2,
      \"filter\": {
        \"evaltype\": 0,
        \"conditions\": [
          { \"conditiontype\": 24, \"value\": \"linux:web:production\" }
        ]
      },
      \"operations\": [
        { \"operationtype\": 2 },
        { \"operationtype\": 4, \"opgroup\": [{ \"groupid\": \"WEB_GROUP_ID\" }] },
        { \"operationtype\": 6, \"optemplate\": [{ \"templateid\": \"TEMPLATE_ID\" }] }
      ]
    },
    \"auth\": \"${AUTH_TOKEN}\",
    \"id\": 7
  }"

Best Practices

  • Use Zabbix Agent 2 (Go-based) over legacy Agent for better plugin support and performance
  • Leverage templates to standardize monitoring — apply templates to host groups, not individual hosts
  • Use HostMetadata in agent config for automatic registration and template linking
  • Set recovery expressions on triggers to prevent flapping between OK and PROBLEM states
  • Use low-level discovery for dynamic infrastructure (containers, disks, network interfaces)
  • Tag triggers and hosts for organized alerting and dashboard filtering

当前收录版本

1.0.0

核对来源版本 ↗

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值92/100

亮点

  • 提供企业级 Zabbix 监控完整配置方案,覆盖服务器部署、Agent 配置、模板创建、触发器定义、自动发现等核心场景
  • 内容深度和实用性高,直接解决 DevOps 工程师在基础设施监控中的高频刚需问题
触发精准95/100

亮点

  • 触发描述精准完整,明确列出设置服务器、配置主机监控、创建模板等具体使用场景
  • 边界清晰,不易与其他监控类 Skill 混淆
结构规范90/100

待提升项

  • 缺少显式 When to Use 章节 原报告严重程度:轻微

    文档结构优秀,但未设置显式的 When to Use 章节

    改进建议:建议在 Overview 后增加 When to Use 章节,更清晰地说明适用场景

亮点

  • 结构清晰,分 Task A-F 六个阶段,每阶段有明确目标和完整示例
  • 提供端到端 API 调用示例,便于用户直接执行
执行可靠88/100

待提升项

  • 部分 API 调用需用户手动替换 ID 原报告严重程度:轻微

    多个 API 调用中包含 TEMPLATE_ID、DISCOVERY_RULE_ID 等占位符,需用户自行获取替换

    改进建议:建议增加说明如何获取这些 ID,或提供完整的调用链示例

亮点

  • 工具来源明确,使用官方 Zabbix 镜像和仓库
  • 参数配置合理,包含 recovery_expression 等防抖动机制
  • 覆盖主要异常场景,可靠性良好
证据可验 (前四项均值)91/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

  • 安装或获取外部依赖

    使用官方来源并锁定版本,在隔离环境检查安装脚本。当前文档检查不覆盖后续下载的代码。

    主文档提及 · 第 77 行
  • 管理员或提升权限

    确认确有必要再提升权限;不要关闭防护、绕过证书验证或扩大整个系统的访问权限。

    主文档提及 · 第 75, 76, 77 行
文档引用的域名或地址

这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。

  • localhost
  • repo.zabbix.com

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。