Collect server or cloud VM monitoring data, generate formatted Excel reports, and optionally send summaries via email or Feishu/Lark.
| Source | Auth | Notes |
|---|---|---|
| -------- | ------ | ------- |
| Zabbix | User/Pass or API Token | Host groups, memory, CPU, disk |
| Prometheus | URL only | PromQL queries |
| Alibaba Cloud CMS | AccessKey/SecretKey | ECS, RDS, SLB, EIP metrics |
| Tencent Cloud CAM | SecretID/Key | TC3-HMAC-SHA256 signature |
| Huawei Cloud IAM | AccessKey/SecretKey | IAM Token auth |
Data sources are auto-detected from .env — configure credentials for any combination and they will all be collected.
Create/edit ~/.hermes/.env. Only configure the sources you need:
# --- Zabbix (pick one auth method) ---
ZABBIX_URL=https://zabbix.example.com/api_jsonrpc.php
ZABBIX_USER=Admin
ZABBIX_PASSWORD=your_password
# ZABBIX_TOKEN=your_api_token # optional, takes priority over password
# --- Alibaba Cloud ---
ALIBABA_ACCESS_KEY_ID=your_key_id
ALIBABA_ACCESS_KEY_SECRET=your_secret
ALIBABA_REGION=cn-hangzhou
# ALIBABA_METRICS=CPUUtilization,MemoryUtilization,InternetInRate # optional
# --- Tencent Cloud ---
TENCENT_SECRET_ID=your_secret_id
TENCENT_SECRET_KEY=your_secret_key
TENCENT_REGION=ap-shanghai
# --- Huawei Cloud ---
HUAWEI_ACCESS_KEY=your_access_key
HUAWEI_SECRET_KEY=your_secret_key
HUAWEI_REGION=cn-east-3
# --- Notifications ---
FEISHU_CHAT_ID=oc_xxxx # optional
SMTP_HOST=smtp.example.com # optional, omit to skip email
SMTP_PORT=465
SMTP_FROM=alarm@example.com
SMTP_TOKEN=your_token
TARGET_EMAIL=admin@example.com
# --- Report options ---
# TOPN: show top N hosts by memory+CPU score, 0=off (default: 50)
TOPN=50
Zabbix / Prometheus — no extra deps:
python3 zabbix_cron.py
Alibaba Cloud — needs SDK (use uv since venv has no pip):
uv run --with aliyun-python-sdk-core --with aliyun-python-sdk-cms \
python3 cloud_monitor.py
Tencent / Huawei — pure Python, only httpx needed:
uv run --with httpx python3 cloud_monitor.py
python3 zabbix_cron.py
Expected output:
~/.hermes/cron/output/zabbix_monitor.csv~/.hermes/cron/output/zabbix_monitor.xlsx (one sheet per host group + overview + TOP sheet)hermes cron create \
--name "Daily Server Health Report" \
--script zabbix_cron.py \
--schedule "30 9 * * *"
主机组, 主机名, IP, 内存可用(GB), 内存总量(GB), 内存占用率(%), CPU占用率(%)🔴 ≥80% red, 🟠 ≥60% orange, 🟡 ≥40% yellowScripts detect which sources to use based on which env vars are set:
| Env var present | Data source used |
|---|---|
| ---------------- | ----------------- |
ZABBIX_URL | Zabbix API |
ALIBABA_ACCESS_KEY_ID | Alibaba Cloud CMS (SDK) |
TENCENT_SECRET_ID | Tencent Cloud CAM (TC3签名) |
HUAWEI_ACCESS_KEY | Huawei Cloud IAM (Token) |
PROMETHEUS_URL | Prometheus PromQL |
These groups are excluded by default (set in EXCLUDE_GROUPS in script):
Templates* — template groupsDiscovered hosts — Zabbix auto-discovery| Key | Description |
|---|---|
| ----- | ------------- |
vm.memory.size[available] | Memory available (bytes) |
vm.memory.size[total] | Memory total (bytes) |
system.cpu.util | CPU utilization (%) |
vfs.fs.size[/,pused] | Root disk usage (%) |
| Metric | Warning | Alarm |
|---|---|---|
| -------- | --------- | ------- |
| Memory usage | ≥40% yellow | ≥60% orange, ≥80% red |
| CPU usage | ≥40% yellow | ≥60% orange, ≥80% red |
Markdown card sent to FEISHU_CHAT_ID containing:
服务器监控报告 YYYY-MM-DD HH:MMzabbix_monitor.xlsxreferences/zabbix-config.md — Zabbix API details, item keys, auth optionsreferences/notification-config.md — Feishu and email SMTP setup, common providersreferences/cloud-config.md — Alibaba / Tencent / Huawei API endpoints, namespaces, SDK usage~/.hermes/.envN/A, CPU still worksMemoryUtilization requires Cloud Monitor Agent installed on ECS instance共 1 个版本