12 Commits

Author SHA1 Message Date
admin 46f90964c1 添加 veeam全任务.ps1 2026-05-27 17:06:41 +08:00
admin d49aa30359 添加 veeam(全任务).json 2026-05-27 17:06:01 +08:00
admin 8f20919725 添加 veeam显示其他任务类型版.ps1 2026-05-27 16:45:15 +08:00
admin d0f536d148 添加 veeam最终版.ps1 2026-05-27 16:33:34 +08:00
admin f7bf654157 更新 READM.txt 2026-05-27 16:25:17 +08:00
admin ac7cd21d7f 添加 veeam最终版.json 2026-05-27 16:24:11 +08:00
admin 3b457f5d2d 添加 veeam(改良版).json 2026-05-27 16:17:30 +08:00
admin 46a665b6fa 更新 veeam1.ps1 2026-05-27 16:05:43 +08:00
admin f2d0f7f989 1.1 2026-05-27 16:05:01 +08:00
admin bda016864b 添加 READM.txt 2026-05-27 11:25:32 +08:00
admin fd239a3839 添加 veeam.ps1 2026-05-27 11:23:11 +08:00
admin d521f33a1f 添加 install_node_exporter.sh 2026-05-26 10:25:47 +08:00
65 changed files with 6173 additions and 205440 deletions
+49
View File
@@ -0,0 +1,49 @@
#curl -s 127.0.0.1:9091/metrics | grep node_textfile_scrape_error
验证prom文件是否有格式问题
#node_exporter 配置文件
# 1. 强制覆盖 service 文件
cat > /etc/systemd/system/node_exporter.service << 'EOF'
[Unit]
Description=Node Exporter
After=network.target
[Service]
User=root
ExecStart=/usr/local/bin/node_exporter --collector.textfile.directory=/opt/prom_textfile
Restart=always
[Install]
WantedBy=multi-user.target
EOF
# 2. 必须重新加载配置
systemctl daemon-reload
# 3. 强制重启
systemctl stop node_exporter
sleep 2
systemctl start node_exporter
# 4. 检查是否真的带了 textfile 参数
ps aux | grep node_exporter
第一步:先生成密钥(必须先做!)
打开 PowerShell,直接运行这条命令,全程按 3 次回车,什么都不用输入:
powershell
ssh-keygen -t rsa
✅ 出现下面的文字就成功了:
plaintext
Generating public/private rsa key pair.
第二步:再运行这条授权命令(这次一定成功)
powershell
Get-Content ~/.ssh/id_rsa.pub | ssh root@10.150.117.190 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"
运行后只需要输入一次 Linux 密码,以后永远不用再输!
#时间戳问题
$LastSuccessTimestamp = [math]::Round($LastSuccessSession.EndTime.ToUniversalTime().Subtract((Get-Date "1970-01-01")).TotalSeconds, 0)
# 修改后的代码(毫秒级)
$LastSuccessTimestamp = [math]::Round($LastSuccessSession.EndTime.ToUniversalTime().Subtract((Get-Date "1970-01-01")).TotalMilliseconds, 0)
-2
View File
@@ -1,2 +0,0 @@
nohup: ignoring input
python3: can't open file 'alert_store_webhook.py': [Errno 2] No such file or directory
-32
View File
@@ -1,32 +0,0 @@
global:
resolve_timeout: 5m
route:
group_by: ['alertname', 'job', 'instance', 'port', 'severity']
group_wait: 10s
group_interval: 10s
repeat_interval: 8760h
receiver: 'email-prometheusalert'
routes:
- match_re:
severity: .+
receiver: 'email-prometheusalert'
continue: true
- match_re:
severity: .+
receiver: 'db-webhook-only'
continue: true
receivers:
- name: 'email-prometheusalert'
webhook_configs:
- url: 'http://10.150.117.190:9094/prometheusalert?type=email&tpl=prometheus-email&email=hans.wang@ptn.advantest.com'
send_resolved: true
# MySQL入库接口(旧PHP方案注释保留)
# - url: "http://10.150.117.190:8080/api/webhook.php"
# send_resolved: true
- name: 'db-webhook-only'
webhook_configs:
- url: "http://10.150.117.190:909/alert"
send_resolved: true
-32
View File
@@ -1,32 +0,0 @@
global:
resolve_timeout: 5m
route:
group_by: ['alertname', 'job', 'instance', 'port', 'severity']
group_wait: 10s
group_interval: 10s
repeat_interval: 8760h
receiver: 'email-prometheusalert'
routes:
- match_re:
severity: .+
receiver: 'email-prometheusalert'
continue: true
- match_re:
severity: .+
receiver: 'db-webhook-only'
continue: true
receivers:
- name: 'email-prometheusalert'
webhook_configs:
- url: 'http://10.150.117.190:9094/prometheusalert?type=email&tpl=prometheus-email&email=hans.wang@ptn.advantest.com'
send_resolved: true
# MySQL入库接口(旧PHP方案注释保留)
# - url: "http://10.150.117.190:8080/api/webhook.php"
# send_resolved: true
- name: 'db-webhook-only'
webhook_configs:
- url: "http://10.150.117.190:909/alert"
send_resolved: true
-29
View File
@@ -1,29 +0,0 @@
global:
resolve_timeout: 5m
route:
group_by: ['alertname', 'job', 'instance', 'port', 'severity']
group_wait: 10s
group_interval: 10s
repeat_interval: 8760h
receiver: 'email-prometheusalert'
routes:
- match_re:
severity: .+
receiver: 'db-webhook-only'
continue: true
receivers:
- name: 'email-prometheusalert'
webhook_configs:
# 原有邮件通知
- url: 'http://10.150.117.190:9094/prometheusalert?type=email&tpl=prometheus-email&email=lyudream@163.com'
send_resolved: true
# MySQL入库接口(已废弃,保留注释)
# - url: "http://10.150.117.190:8080/api/webhook.php"
# send_resolved: true
- name: 'db-webhook-only'
webhook_configs:
- url: "http://10.150.117.190:909/alert"
send_resolved: true
-7
View File
@@ -1,7 +0,0 @@
nohup: ignoring input
* Serving Flask app "webhook" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://0.0.0.0:909/ (Press CTRL+C to quit)
-257
View File
@@ -1,257 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_timeout: 8s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
- job_name: "cnshipa01"
static_configs:
- targets: ["10.150.10.81:9100"]
- job_name: "nshipa02"
static_configs:
- targets: ["10.150.10.82:9100"]
- job_name: "cnbjipanfs01"
static_configs:
- targets: ["10.151.10.32:9100"]
- job_name: "twvmipa01"
static_configs:
- targets: ["10.160.10.188:9100"]
- job_name: "twvmipa02"
static_configs:
- targets: ["10.160.10.189:9100"]
- job_name: "twvmipa03"
static_configs:
- targets: ["10.160.10.190:9100"]
- job_name: "twvmipa04"
static_configs:
- targets: ["10.160.10.191:9100"]
- job_name: "cnsznis01"
static_configs:
- targets: ["10.152.10.31:9100"]
- job_name: "cnshipa03"
static_configs:
- targets: ["10.150.10.86:9100"]
- job_name: "usdcnbackup01"
static_configs:
- targets: ["10.115.10.83:9100"]
- job_name: "USATNIS02"
static_configs:
- targets: ["10.108.10.14:9100"]
- job_name: "tcp_port_111_2049_check"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.152.10.118:111
- 10.153.10.30:111
- 10.153.10.30:2049
- 10.153.10.200:111
- 10.153.10.200:2049
- 10.150.111.240:111
- 10.150.111.240:2049
- 10.150.10.180:111
- 10.150.10.81:111
- 10.150.10.83:2049
- 10.151.10.32:111
- 10.151.10.32:2049
- 10.152.10.31:111
- 10.152.10.31:2049
- 10.150.10.86:111
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnshipa04"
static_configs:
- targets: ["10.150.10.87:9100"]
# FreeIPA LDAP 389明文 / 636加密端口连通探测
- job_name: "blackbox-freeipa-ldap"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.150.10.81:389
- 10.150.10.82:389
- 10.150.10.86:389
- 10.150.10.87:389
- 10.160.10.188:389
- 10.160.10.189:389
- 10.160.10.190:389
- 10.160.10.191:389
- 10.152.10.118:389
- 10.153.10.30:389
- 10.151.10.31:389
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnbjipa01"
static_configs:
- targets: ["10.151.10.31:9100"]
- job_name: consul-sd
consul_sd_configs:
- server: 10.150.117.190:8500
tags: ["metrics"]
relabel_configs:
- source_labels: [__meta_consul_health]
regex: passing
action: keep
- source_labels: [__meta_consul_service]
target_label: service
- source_labels: [__meta_consul_address, __meta_consul_service_port]
separator: ":"
target_label: instance
- job_name: "cnshnis01_systemd"
static_configs:
- targets: ["10.150.10.180:9558"]
- job_name: "cnshipa01_systemd"
static_configs:
- targets: ["10.150.10.81:9558"]
- job_name: "cnshipa02_systemd"
static_configs:
- targets: ["10.150.10.82:9558"]
- job_name: "cnshipa03_systemd"
static_configs:
- targets: ["10.150.10.86:9558"]
- job_name: "cnshipa04_systemd"
static_configs:
- targets: ["10.150.10.87:9558"]
- job_name: "nsschina2_systemd"
static_configs:
- targets: ["10.150.111.240:9558"]
- job_name: "cnbjipa01_systemd"
static_configs:
- targets: ["10.151.10.31:9558"]
- job_name: "cnbjipanfs01_systemd"
static_configs:
- targets: ["10.151.10.32:9558"]
- job_name: "cnszipa01_systemd"
static_configs:
- targets: ["10.152.10.118:9558"]
- job_name: "twvmipa01_systemd"
static_configs:
- targets: ["10.160.10.188:9558"]
- job_name: "twvmipa02_systemd"
static_configs:
- targets: ["10.160.10.189:9558"]
- job_name: "twvmipa04_systemd"
static_configs:
- targets: ["10.160.10.191:9558"]
- job_name: "twvmipa03_systemd"
static_configs:
- targets: ["10.160.10.190:9558"]
- job_name: "cnxaipa01_systemd"
static_configs:
- targets: ["10.153.10.30:9558"]
- job_name: blackbox_icmp_ping
metrics_path: /probe
params:
module: [icmp]
static_configs:
- targets:
- 10.150.10.83
- 10.152.10.24
- 10.150.10.55
- 10.153.10.210
- 10.160.10.91
- 10.151.10.34
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- replacement: 10.150.117.190:9115 # blackbox地址
target_label: __address__
- job_name: "blackbox-veeam-port"
scrape_timeout: 10s
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.115.12.185:6160
- 10.115.12.185:6162
- 10.115.12.185:443
- 10.115.12.185:445
relabel_configs:
# 把目标主机:端口传给blackbox探测参数
- source_labels: [__address__]
target_label: __param_target
# instance标签展示完整地址:端口
- source_labels: [__param_target]
target_label: instance
# 实际抓取地址指向远端blackbox服务
- target_label: __address__
replacement: 10.150.117.190:9115
# 提取端口号存入port标签,告警可单独展示端口
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
# 新增业务标签,用于告警分组过滤
- source_labels: []
target_label: business
replacement: veeam_backup
- job_name: 'blackbox-veeam-monitor'
metrics_path: /probe
params:
module: [tcp_connect] # 使用 TCP 连通性探测
static_configs:
- targets:
# Veeam Service Provider Console (VSPC)
# - 10.115.13.209:1989 # usdcnveeamconsole01 (Web UI)
# - 10.115.13.209:9999 # usdcnveeamconsole01 (Server)
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: blackbox-exporter:9115 # 请确保这里替换为您 Blackbox Exporter 的实际地址
-22
View File
@@ -1,22 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
-25
View File
@@ -1,25 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "cnshipanfs01"
static_configs:
- targets: ["10.150.10.83:9100"]
-35
View File
@@ -1,35 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "cnshipanfs01"
static_configs:
- targets: ["10.150.10.83:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
-38
View File
@@ -1,38 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "cnshipanfs01"
static_configs:
- targets: ["10.150.10.83:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
-41
View File
@@ -1,41 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "cnshipanfs01"
static_configs:
- targets: ["10.150.10.83:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
-44
View File
@@ -1,44 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "cnshipanfs01"
static_configs:
- targets: ["10.150.10.83:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
- job_name: "cnshipa01"
static_configs:
- targets: ["10.150.10.81:9100"]
-47
View File
@@ -1,47 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "cnshipanfs01"
static_configs:
- targets: ["10.150.10.83:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
- job_name: "cnshipa01"
static_configs:
- targets: ["10.150.10.81:9100"]
- job_name: "nshipa02"
static_configs:
- targets: ["10.150.10.82:9100"]
-50
View File
@@ -1,50 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "cnshipanfs01"
static_configs:
- targets: ["10.150.10.83:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
- job_name: "cnshipa01"
static_configs:
- targets: ["10.150.10.81:9100"]
- job_name: "nshipa02"
static_configs:
- targets: ["10.150.10.82:9100"]
- job_name: "cnshipa04"
static_configs:
- targets: ["10.150.10.87:9100"]
-53
View File
@@ -1,53 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "cnshipanfs01"
static_configs:
- targets: ["10.150.10.83:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
- job_name: "cnshipa01"
static_configs:
- targets: ["10.150.10.81:9100"]
- job_name: "nshipa02"
static_configs:
- targets: ["10.150.10.82:9100"]
- job_name: "cnshipa04"
static_configs:
- targets: ["10.150.10.87:9100"]
- job_name: "cnbjipanfs01"
static_configs:
- targets: ["10.151.10.32:9100"]
-56
View File
@@ -1,56 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "cnshipanfs01"
static_configs:
- targets: ["10.150.10.83:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
- job_name: "cnshipa01"
static_configs:
- targets: ["10.150.10.81:9100"]
- job_name: "nshipa02"
static_configs:
- targets: ["10.150.10.82:9100"]
- job_name: "cnshipa04"
static_configs:
- targets: ["10.150.10.87:9100"]
- job_name: "cnbjipanfs01"
static_configs:
- targets: ["10.151.10.32:9100"]
- job_name: "twvmipa01"
static_configs:
- targets: ["10.160.10.188:9100"]
-59
View File
@@ -1,59 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "cnshipanfs01"
static_configs:
- targets: ["10.150.10.83:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
- job_name: "cnshipa01"
static_configs:
- targets: ["10.150.10.81:9100"]
- job_name: "nshipa02"
static_configs:
- targets: ["10.150.10.82:9100"]
- job_name: "cnshipa04"
static_configs:
- targets: ["10.150.10.87:9100"]
- job_name: "cnbjipanfs01"
static_configs:
- targets: ["10.151.10.32:9100"]
- job_name: "twvmipa01"
static_configs:
- targets: ["10.160.10.188:9100"]
- job_name: "twvmipa02"
static_configs:
- targets: ["10.160.10.189:9100"]
-62
View File
@@ -1,62 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "cnshipanfs01"
static_configs:
- targets: ["10.150.10.83:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
- job_name: "cnshipa01"
static_configs:
- targets: ["10.150.10.81:9100"]
- job_name: "nshipa02"
static_configs:
- targets: ["10.150.10.82:9100"]
- job_name: "cnshipa04"
static_configs:
- targets: ["10.150.10.87:9100"]
- job_name: "cnbjipanfs01"
static_configs:
- targets: ["10.151.10.32:9100"]
- job_name: "twvmipa01"
static_configs:
- targets: ["10.160.10.188:9100"]
- job_name: "twvmipa02"
static_configs:
- targets: ["10.160.10.189:9100"]
- job_name: "twvmipa03"
static_configs:
- targets: ["10.160.10.190:9100"]
-65
View File
@@ -1,65 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "cnshipanfs01"
static_configs:
- targets: ["10.150.10.83:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
- job_name: "cnshipa01"
static_configs:
- targets: ["10.150.10.81:9100"]
- job_name: "nshipa02"
static_configs:
- targets: ["10.150.10.82:9100"]
- job_name: "cnshipa04"
static_configs:
- targets: ["10.150.10.87:9100"]
- job_name: "cnbjipanfs01"
static_configs:
- targets: ["10.151.10.32:9100"]
- job_name: "twvmipa01"
static_configs:
- targets: ["10.160.10.188:9100"]
- job_name: "twvmipa02"
static_configs:
- targets: ["10.160.10.189:9100"]
- job_name: "twvmipa03"
static_configs:
- targets: ["10.160.10.190:9100"]
- job_name: "twvmipa04"
static_configs:
- targets: ["10.160.10.191:9100"]
-68
View File
@@ -1,68 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "cnshipanfs01"
static_configs:
- targets: ["10.150.10.83:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
- job_name: "cnshipa01"
static_configs:
- targets: ["10.150.10.81:9100"]
- job_name: "nshipa02"
static_configs:
- targets: ["10.150.10.82:9100"]
- job_name: "cnshipa04"
static_configs:
- targets: ["10.150.10.87:9100"]
- job_name: "cnbjipanfs01"
static_configs:
- targets: ["10.151.10.32:9100"]
- job_name: "twvmipa01"
static_configs:
- targets: ["10.160.10.188:9100"]
- job_name: "twvmipa02"
static_configs:
- targets: ["10.160.10.189:9100"]
- job_name: "twvmipa03"
static_configs:
- targets: ["10.160.10.190:9100"]
- job_name: "twvmipa04"
static_configs:
- targets: ["10.160.10.191:9100"]
- job_name: "cnsznis01"
static_configs:
- targets: ["10.152.10.31:9100"]
-71
View File
@@ -1,71 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "cnshipanfs01"
static_configs:
- targets: ["10.150.10.83:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
- job_name: "cnshipa01"
static_configs:
- targets: ["10.150.10.81:9100"]
- job_name: "nshipa02"
static_configs:
- targets: ["10.150.10.82:9100"]
- job_name: "cnshipa04"
static_configs:
- targets: ["10.150.10.87:9100"]
- job_name: "cnbjipanfs01"
static_configs:
- targets: ["10.151.10.32:9100"]
- job_name: "twvmipa01"
static_configs:
- targets: ["10.160.10.188:9100"]
- job_name: "twvmipa02"
static_configs:
- targets: ["10.160.10.189:9100"]
- job_name: "twvmipa03"
static_configs:
- targets: ["10.160.10.190:9100"]
- job_name: "twvmipa04"
static_configs:
- targets: ["10.160.10.191:9100"]
- job_name: "cnsznis01"
static_configs:
- targets: ["10.152.10.31:9100"]
- job_name: "cnshipa03"
static_configs:
- targets: ["10.150.10.86:9100"]
-74
View File
@@ -1,74 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "cnshipanfs01"
static_configs:
- targets: ["10.150.10.83:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
- job_name: "cnshipa01"
static_configs:
- targets: ["10.150.10.81:9100"]
- job_name: "nshipa02"
static_configs:
- targets: ["10.150.10.82:9100"]
- job_name: "cnshipa04"
static_configs:
- targets: ["10.150.10.87:9100"]
- job_name: "cnbjipanfs01"
static_configs:
- targets: ["10.151.10.32:9100"]
- job_name: "twvmipa01"
static_configs:
- targets: ["10.160.10.188:9100"]
- job_name: "twvmipa02"
static_configs:
- targets: ["10.160.10.189:9100"]
- job_name: "twvmipa03"
static_configs:
- targets: ["10.160.10.190:9100"]
- job_name: "twvmipa04"
static_configs:
- targets: ["10.160.10.191:9100"]
- job_name: "cnsznis01"
static_configs:
- targets: ["10.152.10.31:9100"]
- job_name: "cnshipa03"
static_configs:
- targets: ["10.150.10.86:9100"]
- job_name: "10.115.10.83"
static_configs:
- targets: [":9100"]
-74
View File
@@ -1,74 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "cnshipanfs01"
static_configs:
- targets: ["10.150.10.83:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
- job_name: "cnshipa01"
static_configs:
- targets: ["10.150.10.81:9100"]
- job_name: "nshipa02"
static_configs:
- targets: ["10.150.10.82:9100"]
- job_name: "cnshipa04"
static_configs:
- targets: ["10.150.10.87:9100"]
- job_name: "cnbjipanfs01"
static_configs:
- targets: ["10.151.10.32:9100"]
- job_name: "twvmipa01"
static_configs:
- targets: ["10.160.10.188:9100"]
- job_name: "twvmipa02"
static_configs:
- targets: ["10.160.10.189:9100"]
- job_name: "twvmipa03"
static_configs:
- targets: ["10.160.10.190:9100"]
- job_name: "twvmipa04"
static_configs:
- targets: ["10.160.10.191:9100"]
- job_name: "cnsznis01"
static_configs:
- targets: ["10.152.10.31:9100"]
- job_name: "cnshipa03"
static_configs:
- targets: ["10.150.10.86:9100"]
- job_name: "usdcnbackup01"
static_configs:
- targets: ["10.115.10.83:9100"]
-102
View File
@@ -1,102 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
- job_name: "cnshipa01"
static_configs:
- targets: ["10.150.10.81:9100"]
- job_name: "nshipa02"
static_configs:
- targets: ["10.150.10.82:9100"]
- job_name: "cnbjipanfs01"
static_configs:
- targets: ["10.151.10.32:9100"]
- job_name: "twvmipa01"
static_configs:
- targets: ["10.160.10.188:9100"]
- job_name: "twvmipa02"
static_configs:
- targets: ["10.160.10.189:9100"]
- job_name: "twvmipa03"
static_configs:
- targets: ["10.160.10.190:9100"]
- job_name: "twvmipa04"
static_configs:
- targets: ["10.160.10.191:9100"]
- job_name: "cnsznis01"
static_configs:
- targets: ["10.152.10.31:9100"]
- job_name: "cnshipa03"
static_configs:
- targets: ["10.150.10.86:9100"]
- job_name: "usdcnbackup01"
static_configs:
- targets: ["10.115.10.83:9100"]
- job_name: "USATNIS02"
static_configs:
- targets: ["10.108.10.14:9100"]
- job_name: "tcp_port_111_2049_check"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.152.10.118:111
- 10.153.10.30:111
- 10.153.10.30:2049
- 10.153.10.200:111
- 10.153.10.200:2049
- 10.150.111.240:111
- 10.150.111.240:2049
- 10.150.10.180:111
- 10.150.10.81:111
- 10.151.10.32:111
- 10.151.10.32:2049
- 10.152.10.31:111
- 10.152.10.31:2049
- 10.150.10.86:111
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
-135
View File
@@ -1,135 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_timeout: 8s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
- job_name: "cnshipa01"
static_configs:
- targets: ["10.150.10.81:9100"]
- job_name: "nshipa02"
static_configs:
- targets: ["10.150.10.82:9100"]
- job_name: "cnbjipanfs01"
static_configs:
- targets: ["10.151.10.32:9100"]
- job_name: "twvmipa01"
static_configs:
- targets: ["10.160.10.188:9100"]
- job_name: "twvmipa02"
static_configs:
- targets: ["10.160.10.189:9100"]
- job_name: "twvmipa03"
static_configs:
- targets: ["10.160.10.190:9100"]
- job_name: "twvmipa04"
static_configs:
- targets: ["10.160.10.191:9100"]
- job_name: "cnsznis01"
static_configs:
- targets: ["10.152.10.31:9100"]
- job_name: "cnshipa03"
static_configs:
- targets: ["10.150.10.86:9100"]
- job_name: "usdcnbackup01"
static_configs:
- targets: ["10.115.10.83:9100"]
- job_name: "USATNIS02"
static_configs:
- targets: ["10.108.10.14:9100"]
- job_name: "tcp_port_111_2049_check"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.152.10.118:111
- 10.153.10.30:111
- 10.153.10.30:2049
- 10.153.10.200:111
- 10.153.10.200:2049
- 10.150.111.240:111
- 10.150.111.240:2049
- 10.150.10.180:111
- 10.150.10.81:111
- 10.151.10.32:111
- 10.151.10.32:2049
- 10.152.10.31:111
- 10.152.10.31:2049
- 10.150.10.86:111
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnshipa04"
static_configs:
- targets: ["10.150.10.87:9100"]
# FreeIPA LDAP 389明文 / 636加密端口连通探测
- job_name: "blackbox-freeipa-ldap"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.150.10.81:389
- 10.150.10.82:389
- 10.150.10.86:389
- 10.150.10.87:389
- 10.160.10.188:389
- 10.160.10.189:389
- 10.160.10.190:389
- 10.160.10.191:389
- 10.152.10.118:389
- 10.153.10.30:389
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
-158
View File
@@ -1,158 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_timeout: 8s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
- job_name: "cnshipa01"
static_configs:
- targets: ["10.150.10.81:9100"]
- job_name: "nshipa02"
static_configs:
- targets: ["10.150.10.82:9100"]
- job_name: "cnbjipanfs01"
static_configs:
- targets: ["10.151.10.32:9100"]
- job_name: "twvmipa01"
static_configs:
- targets: ["10.160.10.188:9100"]
- job_name: "twvmipa02"
static_configs:
- targets: ["10.160.10.189:9100"]
- job_name: "twvmipa03"
static_configs:
- targets: ["10.160.10.190:9100"]
- job_name: "twvmipa04"
static_configs:
- targets: ["10.160.10.191:9100"]
- job_name: "cnsznis01"
static_configs:
- targets: ["10.152.10.31:9100"]
- job_name: "cnshipa03"
static_configs:
- targets: ["10.150.10.86:9100"]
- job_name: "usdcnbackup01"
static_configs:
- targets: ["10.115.10.83:9100"]
- job_name: "USATNIS02"
static_configs:
- targets: ["10.108.10.14:9100"]
- job_name: "tcp_port_111_2049_check"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.152.10.118:111
- 10.153.10.30:111
- 10.153.10.30:2049
- 10.153.10.200:111
- 10.153.10.200:2049
- 10.150.111.240:111
- 10.150.111.240:2049
- 10.150.10.180:111
- 10.150.10.81:111
- 10.151.10.32:111
- 10.151.10.32:2049
- 10.152.10.31:111
- 10.152.10.31:2049
- 10.150.10.86:111
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnshipa04"
static_configs:
- targets: ["10.150.10.87:9100"]
# FreeIPA LDAP 389明文 / 636加密端口连通探测
- job_name: "blackbox-freeipa-ldap"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.150.10.81:389
- 10.150.10.82:389
- 10.150.10.86:389
- 10.150.10.87:389
- 10.160.10.188:389
- 10.160.10.189:389
- 10.160.10.190:389
- 10.160.10.191:389
- 10.152.10.118:389
- 10.153.10.30:389
- 10.151.10.31:389
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnbjipa01"
static_configs:
- targets: ["10.151.10.31:9100"]
- job_name: consul-sd
consul_sd_configs:
- server: 10.150.117.190:8500
tags: ["metrics"]
relabel_configs:
- source_labels: [__meta_consul_health]
regex: passing
action: keep
- source_labels: [__meta_consul_service]
target_label: service
- source_labels: [__meta_consul_address, __meta_consul_service_port]
separator: ":"
target_label: instance
- job_name: "systemd"
static_configs:
- targets:
- 10.150.10.180:9558
- 10.150.10.86:9558
-156
View File
@@ -1,156 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_timeout: 8s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
- job_name: "cnshipa01"
static_configs:
- targets: ["10.150.10.81:9100"]
- job_name: "nshipa02"
static_configs:
- targets: ["10.150.10.82:9100"]
- job_name: "cnbjipanfs01"
static_configs:
- targets: ["10.151.10.32:9100"]
- job_name: "twvmipa01"
static_configs:
- targets: ["10.160.10.188:9100"]
- job_name: "twvmipa02"
static_configs:
- targets: ["10.160.10.189:9100"]
- job_name: "twvmipa03"
static_configs:
- targets: ["10.160.10.190:9100"]
- job_name: "twvmipa04"
static_configs:
- targets: ["10.160.10.191:9100"]
- job_name: "cnsznis01"
static_configs:
- targets: ["10.152.10.31:9100"]
- job_name: "cnshipa03"
static_configs:
- targets: ["10.150.10.86:9100"]
- job_name: "usdcnbackup01"
static_configs:
- targets: ["10.115.10.83:9100"]
- job_name: "USATNIS02"
static_configs:
- targets: ["10.108.10.14:9100"]
- job_name: "tcp_port_111_2049_check"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.152.10.118:111
- 10.153.10.30:111
- 10.153.10.30:2049
- 10.153.10.200:111
- 10.153.10.200:2049
- 10.150.111.240:111
- 10.150.111.240:2049
- 10.150.10.180:111
- 10.150.10.81:111
- 10.151.10.32:111
- 10.151.10.32:2049
- 10.152.10.31:111
- 10.152.10.31:2049
- 10.150.10.86:111
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnshipa04"
static_configs:
- targets: ["10.150.10.87:9100"]
# FreeIPA LDAP 389明文 / 636加密端口连通探测
- job_name: "blackbox-freeipa-ldap"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.150.10.81:389
- 10.150.10.82:389
- 10.150.10.86:389
- 10.150.10.87:389
- 10.160.10.188:389
- 10.160.10.189:389
- 10.160.10.190:389
- 10.160.10.191:389
- 10.152.10.118:389
- 10.153.10.30:389
- 10.151.10.31:389
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnbjipa01"
static_configs:
- targets: ["10.151.10.31:9100"]
- job_name: consul-sd
consul_sd_configs:
- server: 10.150.117.190:8500
tags: ["metrics"]
relabel_configs:
- source_labels: [__meta_consul_health]
regex: passing
action: keep
- source_labels: [__meta_consul_service]
target_label: service
- source_labels: [__meta_consul_address, __meta_consul_service_port]
separator: ":"
target_label: instance
- job_name: "cnshnis01_systemd"
static_configs:
- targets: ["10.150.10.180:9558"]
-159
View File
@@ -1,159 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_timeout: 8s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
- job_name: "cnshipa01"
static_configs:
- targets: ["10.150.10.81:9100"]
- job_name: "nshipa02"
static_configs:
- targets: ["10.150.10.82:9100"]
- job_name: "cnbjipanfs01"
static_configs:
- targets: ["10.151.10.32:9100"]
- job_name: "twvmipa01"
static_configs:
- targets: ["10.160.10.188:9100"]
- job_name: "twvmipa02"
static_configs:
- targets: ["10.160.10.189:9100"]
- job_name: "twvmipa03"
static_configs:
- targets: ["10.160.10.190:9100"]
- job_name: "twvmipa04"
static_configs:
- targets: ["10.160.10.191:9100"]
- job_name: "cnsznis01"
static_configs:
- targets: ["10.152.10.31:9100"]
- job_name: "cnshipa03"
static_configs:
- targets: ["10.150.10.86:9100"]
- job_name: "usdcnbackup01"
static_configs:
- targets: ["10.115.10.83:9100"]
- job_name: "USATNIS02"
static_configs:
- targets: ["10.108.10.14:9100"]
- job_name: "tcp_port_111_2049_check"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.152.10.118:111
- 10.153.10.30:111
- 10.153.10.30:2049
- 10.153.10.200:111
- 10.153.10.200:2049
- 10.150.111.240:111
- 10.150.111.240:2049
- 10.150.10.180:111
- 10.150.10.81:111
- 10.151.10.32:111
- 10.151.10.32:2049
- 10.152.10.31:111
- 10.152.10.31:2049
- 10.150.10.86:111
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnshipa04"
static_configs:
- targets: ["10.150.10.87:9100"]
# FreeIPA LDAP 389明文 / 636加密端口连通探测
- job_name: "blackbox-freeipa-ldap"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.150.10.81:389
- 10.150.10.82:389
- 10.150.10.86:389
- 10.150.10.87:389
- 10.160.10.188:389
- 10.160.10.189:389
- 10.160.10.190:389
- 10.160.10.191:389
- 10.152.10.118:389
- 10.153.10.30:389
- 10.151.10.31:389
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnbjipa01"
static_configs:
- targets: ["10.151.10.31:9100"]
- job_name: consul-sd
consul_sd_configs:
- server: 10.150.117.190:8500
tags: ["metrics"]
relabel_configs:
- source_labels: [__meta_consul_health]
regex: passing
action: keep
- source_labels: [__meta_consul_service]
target_label: service
- source_labels: [__meta_consul_address, __meta_consul_service_port]
separator: ":"
target_label: instance
- job_name: "cnshnis01_systemd"
static_configs:
- targets: ["10.150.10.180:9558"]
- job_name: "cnshipa01_systemd"
static_configs:
- targets: ["10.150.10.81:9558"]
-162
View File
@@ -1,162 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_timeout: 8s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
- job_name: "cnshipa01"
static_configs:
- targets: ["10.150.10.81:9100"]
- job_name: "nshipa02"
static_configs:
- targets: ["10.150.10.82:9100"]
- job_name: "cnbjipanfs01"
static_configs:
- targets: ["10.151.10.32:9100"]
- job_name: "twvmipa01"
static_configs:
- targets: ["10.160.10.188:9100"]
- job_name: "twvmipa02"
static_configs:
- targets: ["10.160.10.189:9100"]
- job_name: "twvmipa03"
static_configs:
- targets: ["10.160.10.190:9100"]
- job_name: "twvmipa04"
static_configs:
- targets: ["10.160.10.191:9100"]
- job_name: "cnsznis01"
static_configs:
- targets: ["10.152.10.31:9100"]
- job_name: "cnshipa03"
static_configs:
- targets: ["10.150.10.86:9100"]
- job_name: "usdcnbackup01"
static_configs:
- targets: ["10.115.10.83:9100"]
- job_name: "USATNIS02"
static_configs:
- targets: ["10.108.10.14:9100"]
- job_name: "tcp_port_111_2049_check"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.152.10.118:111
- 10.153.10.30:111
- 10.153.10.30:2049
- 10.153.10.200:111
- 10.153.10.200:2049
- 10.150.111.240:111
- 10.150.111.240:2049
- 10.150.10.180:111
- 10.150.10.81:111
- 10.151.10.32:111
- 10.151.10.32:2049
- 10.152.10.31:111
- 10.152.10.31:2049
- 10.150.10.86:111
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnshipa04"
static_configs:
- targets: ["10.150.10.87:9100"]
# FreeIPA LDAP 389明文 / 636加密端口连通探测
- job_name: "blackbox-freeipa-ldap"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.150.10.81:389
- 10.150.10.82:389
- 10.150.10.86:389
- 10.150.10.87:389
- 10.160.10.188:389
- 10.160.10.189:389
- 10.160.10.190:389
- 10.160.10.191:389
- 10.152.10.118:389
- 10.153.10.30:389
- 10.151.10.31:389
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnbjipa01"
static_configs:
- targets: ["10.151.10.31:9100"]
- job_name: consul-sd
consul_sd_configs:
- server: 10.150.117.190:8500
tags: ["metrics"]
relabel_configs:
- source_labels: [__meta_consul_health]
regex: passing
action: keep
- source_labels: [__meta_consul_service]
target_label: service
- source_labels: [__meta_consul_address, __meta_consul_service_port]
separator: ":"
target_label: instance
- job_name: "cnshnis01_systemd"
static_configs:
- targets: ["10.150.10.180:9558"]
- job_name: "cnshipa01_systemd"
static_configs:
- targets: ["10.150.10.81:9558"]
- job_name: "cnshipa02_systemd"
static_configs:
- targets: ["10.150.10.82:9558"]
-165
View File
@@ -1,165 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_timeout: 8s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
- job_name: "cnshipa01"
static_configs:
- targets: ["10.150.10.81:9100"]
- job_name: "nshipa02"
static_configs:
- targets: ["10.150.10.82:9100"]
- job_name: "cnbjipanfs01"
static_configs:
- targets: ["10.151.10.32:9100"]
- job_name: "twvmipa01"
static_configs:
- targets: ["10.160.10.188:9100"]
- job_name: "twvmipa02"
static_configs:
- targets: ["10.160.10.189:9100"]
- job_name: "twvmipa03"
static_configs:
- targets: ["10.160.10.190:9100"]
- job_name: "twvmipa04"
static_configs:
- targets: ["10.160.10.191:9100"]
- job_name: "cnsznis01"
static_configs:
- targets: ["10.152.10.31:9100"]
- job_name: "cnshipa03"
static_configs:
- targets: ["10.150.10.86:9100"]
- job_name: "usdcnbackup01"
static_configs:
- targets: ["10.115.10.83:9100"]
- job_name: "USATNIS02"
static_configs:
- targets: ["10.108.10.14:9100"]
- job_name: "tcp_port_111_2049_check"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.152.10.118:111
- 10.153.10.30:111
- 10.153.10.30:2049
- 10.153.10.200:111
- 10.153.10.200:2049
- 10.150.111.240:111
- 10.150.111.240:2049
- 10.150.10.180:111
- 10.150.10.81:111
- 10.151.10.32:111
- 10.151.10.32:2049
- 10.152.10.31:111
- 10.152.10.31:2049
- 10.150.10.86:111
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnshipa04"
static_configs:
- targets: ["10.150.10.87:9100"]
# FreeIPA LDAP 389明文 / 636加密端口连通探测
- job_name: "blackbox-freeipa-ldap"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.150.10.81:389
- 10.150.10.82:389
- 10.150.10.86:389
- 10.150.10.87:389
- 10.160.10.188:389
- 10.160.10.189:389
- 10.160.10.190:389
- 10.160.10.191:389
- 10.152.10.118:389
- 10.153.10.30:389
- 10.151.10.31:389
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnbjipa01"
static_configs:
- targets: ["10.151.10.31:9100"]
- job_name: consul-sd
consul_sd_configs:
- server: 10.150.117.190:8500
tags: ["metrics"]
relabel_configs:
- source_labels: [__meta_consul_health]
regex: passing
action: keep
- source_labels: [__meta_consul_service]
target_label: service
- source_labels: [__meta_consul_address, __meta_consul_service_port]
separator: ":"
target_label: instance
- job_name: "cnshnis01_systemd"
static_configs:
- targets: ["10.150.10.180:9558"]
- job_name: "cnshipa01_systemd"
static_configs:
- targets: ["10.150.10.81:9558"]
- job_name: "cnshipa02_systemd"
static_configs:
- targets: ["10.150.10.82:9558"]
- job_name: "cnshipa03_systemd"
static_configs:
- targets: ["10.150.10.86:9558"]
-168
View File
@@ -1,168 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_timeout: 8s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
- job_name: "cnshipa01"
static_configs:
- targets: ["10.150.10.81:9100"]
- job_name: "nshipa02"
static_configs:
- targets: ["10.150.10.82:9100"]
- job_name: "cnbjipanfs01"
static_configs:
- targets: ["10.151.10.32:9100"]
- job_name: "twvmipa01"
static_configs:
- targets: ["10.160.10.188:9100"]
- job_name: "twvmipa02"
static_configs:
- targets: ["10.160.10.189:9100"]
- job_name: "twvmipa03"
static_configs:
- targets: ["10.160.10.190:9100"]
- job_name: "twvmipa04"
static_configs:
- targets: ["10.160.10.191:9100"]
- job_name: "cnsznis01"
static_configs:
- targets: ["10.152.10.31:9100"]
- job_name: "cnshipa03"
static_configs:
- targets: ["10.150.10.86:9100"]
- job_name: "usdcnbackup01"
static_configs:
- targets: ["10.115.10.83:9100"]
- job_name: "USATNIS02"
static_configs:
- targets: ["10.108.10.14:9100"]
- job_name: "tcp_port_111_2049_check"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.152.10.118:111
- 10.153.10.30:111
- 10.153.10.30:2049
- 10.153.10.200:111
- 10.153.10.200:2049
- 10.150.111.240:111
- 10.150.111.240:2049
- 10.150.10.180:111
- 10.150.10.81:111
- 10.151.10.32:111
- 10.151.10.32:2049
- 10.152.10.31:111
- 10.152.10.31:2049
- 10.150.10.86:111
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnshipa04"
static_configs:
- targets: ["10.150.10.87:9100"]
# FreeIPA LDAP 389明文 / 636加密端口连通探测
- job_name: "blackbox-freeipa-ldap"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.150.10.81:389
- 10.150.10.82:389
- 10.150.10.86:389
- 10.150.10.87:389
- 10.160.10.188:389
- 10.160.10.189:389
- 10.160.10.190:389
- 10.160.10.191:389
- 10.152.10.118:389
- 10.153.10.30:389
- 10.151.10.31:389
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnbjipa01"
static_configs:
- targets: ["10.151.10.31:9100"]
- job_name: consul-sd
consul_sd_configs:
- server: 10.150.117.190:8500
tags: ["metrics"]
relabel_configs:
- source_labels: [__meta_consul_health]
regex: passing
action: keep
- source_labels: [__meta_consul_service]
target_label: service
- source_labels: [__meta_consul_address, __meta_consul_service_port]
separator: ":"
target_label: instance
- job_name: "cnshnis01_systemd"
static_configs:
- targets: ["10.150.10.180:9558"]
- job_name: "cnshipa01_systemd"
static_configs:
- targets: ["10.150.10.81:9558"]
- job_name: "cnshipa02_systemd"
static_configs:
- targets: ["10.150.10.82:9558"]
- job_name: "cnshipa03_systemd"
static_configs:
- targets: ["10.150.10.86:9558"]
- job_name: "cnshipa04_systemd"
static_configs:
- targets: ["10.150.10.87:9558"]
-171
View File
@@ -1,171 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_timeout: 8s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
- job_name: "cnshipa01"
static_configs:
- targets: ["10.150.10.81:9100"]
- job_name: "nshipa02"
static_configs:
- targets: ["10.150.10.82:9100"]
- job_name: "cnbjipanfs01"
static_configs:
- targets: ["10.151.10.32:9100"]
- job_name: "twvmipa01"
static_configs:
- targets: ["10.160.10.188:9100"]
- job_name: "twvmipa02"
static_configs:
- targets: ["10.160.10.189:9100"]
- job_name: "twvmipa03"
static_configs:
- targets: ["10.160.10.190:9100"]
- job_name: "twvmipa04"
static_configs:
- targets: ["10.160.10.191:9100"]
- job_name: "cnsznis01"
static_configs:
- targets: ["10.152.10.31:9100"]
- job_name: "cnshipa03"
static_configs:
- targets: ["10.150.10.86:9100"]
- job_name: "usdcnbackup01"
static_configs:
- targets: ["10.115.10.83:9100"]
- job_name: "USATNIS02"
static_configs:
- targets: ["10.108.10.14:9100"]
- job_name: "tcp_port_111_2049_check"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.152.10.118:111
- 10.153.10.30:111
- 10.153.10.30:2049
- 10.153.10.200:111
- 10.153.10.200:2049
- 10.150.111.240:111
- 10.150.111.240:2049
- 10.150.10.180:111
- 10.150.10.81:111
- 10.151.10.32:111
- 10.151.10.32:2049
- 10.152.10.31:111
- 10.152.10.31:2049
- 10.150.10.86:111
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnshipa04"
static_configs:
- targets: ["10.150.10.87:9100"]
# FreeIPA LDAP 389明文 / 636加密端口连通探测
- job_name: "blackbox-freeipa-ldap"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.150.10.81:389
- 10.150.10.82:389
- 10.150.10.86:389
- 10.150.10.87:389
- 10.160.10.188:389
- 10.160.10.189:389
- 10.160.10.190:389
- 10.160.10.191:389
- 10.152.10.118:389
- 10.153.10.30:389
- 10.151.10.31:389
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnbjipa01"
static_configs:
- targets: ["10.151.10.31:9100"]
- job_name: consul-sd
consul_sd_configs:
- server: 10.150.117.190:8500
tags: ["metrics"]
relabel_configs:
- source_labels: [__meta_consul_health]
regex: passing
action: keep
- source_labels: [__meta_consul_service]
target_label: service
- source_labels: [__meta_consul_address, __meta_consul_service_port]
separator: ":"
target_label: instance
- job_name: "cnshnis01_systemd"
static_configs:
- targets: ["10.150.10.180:9558"]
- job_name: "cnshipa01_systemd"
static_configs:
- targets: ["10.150.10.81:9558"]
- job_name: "cnshipa02_systemd"
static_configs:
- targets: ["10.150.10.82:9558"]
- job_name: "cnshipa03_systemd"
static_configs:
- targets: ["10.150.10.86:9558"]
- job_name: "cnshipa04_systemd"
static_configs:
- targets: ["10.150.10.87:9558"]
- job_name: "nsschina2_systemd"
static_configs:
- targets: ["10.150.111.240:9558"]
-174
View File
@@ -1,174 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_timeout: 8s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
- job_name: "cnshipa01"
static_configs:
- targets: ["10.150.10.81:9100"]
- job_name: "nshipa02"
static_configs:
- targets: ["10.150.10.82:9100"]
- job_name: "cnbjipanfs01"
static_configs:
- targets: ["10.151.10.32:9100"]
- job_name: "twvmipa01"
static_configs:
- targets: ["10.160.10.188:9100"]
- job_name: "twvmipa02"
static_configs:
- targets: ["10.160.10.189:9100"]
- job_name: "twvmipa03"
static_configs:
- targets: ["10.160.10.190:9100"]
- job_name: "twvmipa04"
static_configs:
- targets: ["10.160.10.191:9100"]
- job_name: "cnsznis01"
static_configs:
- targets: ["10.152.10.31:9100"]
- job_name: "cnshipa03"
static_configs:
- targets: ["10.150.10.86:9100"]
- job_name: "usdcnbackup01"
static_configs:
- targets: ["10.115.10.83:9100"]
- job_name: "USATNIS02"
static_configs:
- targets: ["10.108.10.14:9100"]
- job_name: "tcp_port_111_2049_check"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.152.10.118:111
- 10.153.10.30:111
- 10.153.10.30:2049
- 10.153.10.200:111
- 10.153.10.200:2049
- 10.150.111.240:111
- 10.150.111.240:2049
- 10.150.10.180:111
- 10.150.10.81:111
- 10.151.10.32:111
- 10.151.10.32:2049
- 10.152.10.31:111
- 10.152.10.31:2049
- 10.150.10.86:111
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnshipa04"
static_configs:
- targets: ["10.150.10.87:9100"]
# FreeIPA LDAP 389明文 / 636加密端口连通探测
- job_name: "blackbox-freeipa-ldap"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.150.10.81:389
- 10.150.10.82:389
- 10.150.10.86:389
- 10.150.10.87:389
- 10.160.10.188:389
- 10.160.10.189:389
- 10.160.10.190:389
- 10.160.10.191:389
- 10.152.10.118:389
- 10.153.10.30:389
- 10.151.10.31:389
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnbjipa01"
static_configs:
- targets: ["10.151.10.31:9100"]
- job_name: consul-sd
consul_sd_configs:
- server: 10.150.117.190:8500
tags: ["metrics"]
relabel_configs:
- source_labels: [__meta_consul_health]
regex: passing
action: keep
- source_labels: [__meta_consul_service]
target_label: service
- source_labels: [__meta_consul_address, __meta_consul_service_port]
separator: ":"
target_label: instance
- job_name: "cnshnis01_systemd"
static_configs:
- targets: ["10.150.10.180:9558"]
- job_name: "cnshipa01_systemd"
static_configs:
- targets: ["10.150.10.81:9558"]
- job_name: "cnshipa02_systemd"
static_configs:
- targets: ["10.150.10.82:9558"]
- job_name: "cnshipa03_systemd"
static_configs:
- targets: ["10.150.10.86:9558"]
- job_name: "cnshipa04_systemd"
static_configs:
- targets: ["10.150.10.87:9558"]
- job_name: "nsschina2_systemd"
static_configs:
- targets: ["10.150.111.240:9558"]
- job_name: "cnbjipa01_systemd"
static_configs:
- targets: ["10.151.10.31:9558"]
-177
View File
@@ -1,177 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_timeout: 8s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
- job_name: "cnshipa01"
static_configs:
- targets: ["10.150.10.81:9100"]
- job_name: "nshipa02"
static_configs:
- targets: ["10.150.10.82:9100"]
- job_name: "cnbjipanfs01"
static_configs:
- targets: ["10.151.10.32:9100"]
- job_name: "twvmipa01"
static_configs:
- targets: ["10.160.10.188:9100"]
- job_name: "twvmipa02"
static_configs:
- targets: ["10.160.10.189:9100"]
- job_name: "twvmipa03"
static_configs:
- targets: ["10.160.10.190:9100"]
- job_name: "twvmipa04"
static_configs:
- targets: ["10.160.10.191:9100"]
- job_name: "cnsznis01"
static_configs:
- targets: ["10.152.10.31:9100"]
- job_name: "cnshipa03"
static_configs:
- targets: ["10.150.10.86:9100"]
- job_name: "usdcnbackup01"
static_configs:
- targets: ["10.115.10.83:9100"]
- job_name: "USATNIS02"
static_configs:
- targets: ["10.108.10.14:9100"]
- job_name: "tcp_port_111_2049_check"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.152.10.118:111
- 10.153.10.30:111
- 10.153.10.30:2049
- 10.153.10.200:111
- 10.153.10.200:2049
- 10.150.111.240:111
- 10.150.111.240:2049
- 10.150.10.180:111
- 10.150.10.81:111
- 10.151.10.32:111
- 10.151.10.32:2049
- 10.152.10.31:111
- 10.152.10.31:2049
- 10.150.10.86:111
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnshipa04"
static_configs:
- targets: ["10.150.10.87:9100"]
# FreeIPA LDAP 389明文 / 636加密端口连通探测
- job_name: "blackbox-freeipa-ldap"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.150.10.81:389
- 10.150.10.82:389
- 10.150.10.86:389
- 10.150.10.87:389
- 10.160.10.188:389
- 10.160.10.189:389
- 10.160.10.190:389
- 10.160.10.191:389
- 10.152.10.118:389
- 10.153.10.30:389
- 10.151.10.31:389
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnbjipa01"
static_configs:
- targets: ["10.151.10.31:9100"]
- job_name: consul-sd
consul_sd_configs:
- server: 10.150.117.190:8500
tags: ["metrics"]
relabel_configs:
- source_labels: [__meta_consul_health]
regex: passing
action: keep
- source_labels: [__meta_consul_service]
target_label: service
- source_labels: [__meta_consul_address, __meta_consul_service_port]
separator: ":"
target_label: instance
- job_name: "cnshnis01_systemd"
static_configs:
- targets: ["10.150.10.180:9558"]
- job_name: "cnshipa01_systemd"
static_configs:
- targets: ["10.150.10.81:9558"]
- job_name: "cnshipa02_systemd"
static_configs:
- targets: ["10.150.10.82:9558"]
- job_name: "cnshipa03_systemd"
static_configs:
- targets: ["10.150.10.86:9558"]
- job_name: "cnshipa04_systemd"
static_configs:
- targets: ["10.150.10.87:9558"]
- job_name: "nsschina2_systemd"
static_configs:
- targets: ["10.150.111.240:9558"]
- job_name: "cnbjipa01_systemd"
static_configs:
- targets: ["10.151.10.31:9558"]
- job_name: "cnbjipanfs01_systemd"
static_configs:
- targets: ["10.151.10.32:9558"]
-180
View File
@@ -1,180 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_timeout: 8s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
- job_name: "cnshipa01"
static_configs:
- targets: ["10.150.10.81:9100"]
- job_name: "nshipa02"
static_configs:
- targets: ["10.150.10.82:9100"]
- job_name: "cnbjipanfs01"
static_configs:
- targets: ["10.151.10.32:9100"]
- job_name: "twvmipa01"
static_configs:
- targets: ["10.160.10.188:9100"]
- job_name: "twvmipa02"
static_configs:
- targets: ["10.160.10.189:9100"]
- job_name: "twvmipa03"
static_configs:
- targets: ["10.160.10.190:9100"]
- job_name: "twvmipa04"
static_configs:
- targets: ["10.160.10.191:9100"]
- job_name: "cnsznis01"
static_configs:
- targets: ["10.152.10.31:9100"]
- job_name: "cnshipa03"
static_configs:
- targets: ["10.150.10.86:9100"]
- job_name: "usdcnbackup01"
static_configs:
- targets: ["10.115.10.83:9100"]
- job_name: "USATNIS02"
static_configs:
- targets: ["10.108.10.14:9100"]
- job_name: "tcp_port_111_2049_check"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.152.10.118:111
- 10.153.10.30:111
- 10.153.10.30:2049
- 10.153.10.200:111
- 10.153.10.200:2049
- 10.150.111.240:111
- 10.150.111.240:2049
- 10.150.10.180:111
- 10.150.10.81:111
- 10.151.10.32:111
- 10.151.10.32:2049
- 10.152.10.31:111
- 10.152.10.31:2049
- 10.150.10.86:111
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnshipa04"
static_configs:
- targets: ["10.150.10.87:9100"]
# FreeIPA LDAP 389明文 / 636加密端口连通探测
- job_name: "blackbox-freeipa-ldap"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.150.10.81:389
- 10.150.10.82:389
- 10.150.10.86:389
- 10.150.10.87:389
- 10.160.10.188:389
- 10.160.10.189:389
- 10.160.10.190:389
- 10.160.10.191:389
- 10.152.10.118:389
- 10.153.10.30:389
- 10.151.10.31:389
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnbjipa01"
static_configs:
- targets: ["10.151.10.31:9100"]
- job_name: consul-sd
consul_sd_configs:
- server: 10.150.117.190:8500
tags: ["metrics"]
relabel_configs:
- source_labels: [__meta_consul_health]
regex: passing
action: keep
- source_labels: [__meta_consul_service]
target_label: service
- source_labels: [__meta_consul_address, __meta_consul_service_port]
separator: ":"
target_label: instance
- job_name: "cnshnis01_systemd"
static_configs:
- targets: ["10.150.10.180:9558"]
- job_name: "cnshipa01_systemd"
static_configs:
- targets: ["10.150.10.81:9558"]
- job_name: "cnshipa02_systemd"
static_configs:
- targets: ["10.150.10.82:9558"]
- job_name: "cnshipa03_systemd"
static_configs:
- targets: ["10.150.10.86:9558"]
- job_name: "cnshipa04_systemd"
static_configs:
- targets: ["10.150.10.87:9558"]
- job_name: "nsschina2_systemd"
static_configs:
- targets: ["10.150.111.240:9558"]
- job_name: "cnbjipa01_systemd"
static_configs:
- targets: ["10.151.10.31:9558"]
- job_name: "cnbjipanfs01_systemd"
static_configs:
- targets: ["10.151.10.32:9558"]
- job_name: "cnszipa01_systemd"
static_configs:
- targets: ["10.152.10.118:9558"]
-183
View File
@@ -1,183 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_timeout: 8s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
- job_name: "cnshipa01"
static_configs:
- targets: ["10.150.10.81:9100"]
- job_name: "nshipa02"
static_configs:
- targets: ["10.150.10.82:9100"]
- job_name: "cnbjipanfs01"
static_configs:
- targets: ["10.151.10.32:9100"]
- job_name: "twvmipa01"
static_configs:
- targets: ["10.160.10.188:9100"]
- job_name: "twvmipa02"
static_configs:
- targets: ["10.160.10.189:9100"]
- job_name: "twvmipa03"
static_configs:
- targets: ["10.160.10.190:9100"]
- job_name: "twvmipa04"
static_configs:
- targets: ["10.160.10.191:9100"]
- job_name: "cnsznis01"
static_configs:
- targets: ["10.152.10.31:9100"]
- job_name: "cnshipa03"
static_configs:
- targets: ["10.150.10.86:9100"]
- job_name: "usdcnbackup01"
static_configs:
- targets: ["10.115.10.83:9100"]
- job_name: "USATNIS02"
static_configs:
- targets: ["10.108.10.14:9100"]
- job_name: "tcp_port_111_2049_check"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.152.10.118:111
- 10.153.10.30:111
- 10.153.10.30:2049
- 10.153.10.200:111
- 10.153.10.200:2049
- 10.150.111.240:111
- 10.150.111.240:2049
- 10.150.10.180:111
- 10.150.10.81:111
- 10.151.10.32:111
- 10.151.10.32:2049
- 10.152.10.31:111
- 10.152.10.31:2049
- 10.150.10.86:111
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnshipa04"
static_configs:
- targets: ["10.150.10.87:9100"]
# FreeIPA LDAP 389明文 / 636加密端口连通探测
- job_name: "blackbox-freeipa-ldap"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.150.10.81:389
- 10.150.10.82:389
- 10.150.10.86:389
- 10.150.10.87:389
- 10.160.10.188:389
- 10.160.10.189:389
- 10.160.10.190:389
- 10.160.10.191:389
- 10.152.10.118:389
- 10.153.10.30:389
- 10.151.10.31:389
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnbjipa01"
static_configs:
- targets: ["10.151.10.31:9100"]
- job_name: consul-sd
consul_sd_configs:
- server: 10.150.117.190:8500
tags: ["metrics"]
relabel_configs:
- source_labels: [__meta_consul_health]
regex: passing
action: keep
- source_labels: [__meta_consul_service]
target_label: service
- source_labels: [__meta_consul_address, __meta_consul_service_port]
separator: ":"
target_label: instance
- job_name: "cnshnis01_systemd"
static_configs:
- targets: ["10.150.10.180:9558"]
- job_name: "cnshipa01_systemd"
static_configs:
- targets: ["10.150.10.81:9558"]
- job_name: "cnshipa02_systemd"
static_configs:
- targets: ["10.150.10.82:9558"]
- job_name: "cnshipa03_systemd"
static_configs:
- targets: ["10.150.10.86:9558"]
- job_name: "cnshipa04_systemd"
static_configs:
- targets: ["10.150.10.87:9558"]
- job_name: "nsschina2_systemd"
static_configs:
- targets: ["10.150.111.240:9558"]
- job_name: "cnbjipa01_systemd"
static_configs:
- targets: ["10.151.10.31:9558"]
- job_name: "cnbjipanfs01_systemd"
static_configs:
- targets: ["10.151.10.32:9558"]
- job_name: "cnszipa01_systemd"
static_configs:
- targets: ["10.152.10.118:9558"]
- job_name: "twvmipa01_systemd"
static_configs:
- targets: ["10.160.10.188:9558"]
-186
View File
@@ -1,186 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_timeout: 8s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
- job_name: "cnshipa01"
static_configs:
- targets: ["10.150.10.81:9100"]
- job_name: "nshipa02"
static_configs:
- targets: ["10.150.10.82:9100"]
- job_name: "cnbjipanfs01"
static_configs:
- targets: ["10.151.10.32:9100"]
- job_name: "twvmipa01"
static_configs:
- targets: ["10.160.10.188:9100"]
- job_name: "twvmipa02"
static_configs:
- targets: ["10.160.10.189:9100"]
- job_name: "twvmipa03"
static_configs:
- targets: ["10.160.10.190:9100"]
- job_name: "twvmipa04"
static_configs:
- targets: ["10.160.10.191:9100"]
- job_name: "cnsznis01"
static_configs:
- targets: ["10.152.10.31:9100"]
- job_name: "cnshipa03"
static_configs:
- targets: ["10.150.10.86:9100"]
- job_name: "usdcnbackup01"
static_configs:
- targets: ["10.115.10.83:9100"]
- job_name: "USATNIS02"
static_configs:
- targets: ["10.108.10.14:9100"]
- job_name: "tcp_port_111_2049_check"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.152.10.118:111
- 10.153.10.30:111
- 10.153.10.30:2049
- 10.153.10.200:111
- 10.153.10.200:2049
- 10.150.111.240:111
- 10.150.111.240:2049
- 10.150.10.180:111
- 10.150.10.81:111
- 10.151.10.32:111
- 10.151.10.32:2049
- 10.152.10.31:111
- 10.152.10.31:2049
- 10.150.10.86:111
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnshipa04"
static_configs:
- targets: ["10.150.10.87:9100"]
# FreeIPA LDAP 389明文 / 636加密端口连通探测
- job_name: "blackbox-freeipa-ldap"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.150.10.81:389
- 10.150.10.82:389
- 10.150.10.86:389
- 10.150.10.87:389
- 10.160.10.188:389
- 10.160.10.189:389
- 10.160.10.190:389
- 10.160.10.191:389
- 10.152.10.118:389
- 10.153.10.30:389
- 10.151.10.31:389
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnbjipa01"
static_configs:
- targets: ["10.151.10.31:9100"]
- job_name: consul-sd
consul_sd_configs:
- server: 10.150.117.190:8500
tags: ["metrics"]
relabel_configs:
- source_labels: [__meta_consul_health]
regex: passing
action: keep
- source_labels: [__meta_consul_service]
target_label: service
- source_labels: [__meta_consul_address, __meta_consul_service_port]
separator: ":"
target_label: instance
- job_name: "cnshnis01_systemd"
static_configs:
- targets: ["10.150.10.180:9558"]
- job_name: "cnshipa01_systemd"
static_configs:
- targets: ["10.150.10.81:9558"]
- job_name: "cnshipa02_systemd"
static_configs:
- targets: ["10.150.10.82:9558"]
- job_name: "cnshipa03_systemd"
static_configs:
- targets: ["10.150.10.86:9558"]
- job_name: "cnshipa04_systemd"
static_configs:
- targets: ["10.150.10.87:9558"]
- job_name: "nsschina2_systemd"
static_configs:
- targets: ["10.150.111.240:9558"]
- job_name: "cnbjipa01_systemd"
static_configs:
- targets: ["10.151.10.31:9558"]
- job_name: "cnbjipanfs01_systemd"
static_configs:
- targets: ["10.151.10.32:9558"]
- job_name: "cnszipa01_systemd"
static_configs:
- targets: ["10.152.10.118:9558"]
- job_name: "twvmipa01_systemd"
static_configs:
- targets: ["10.160.10.188:9558"]
- job_name: "twvmipa02_systemd"
static_configs:
- targets: ["10.160.10.189:9558"]
-189
View File
@@ -1,189 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_timeout: 8s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
- job_name: "cnshipa01"
static_configs:
- targets: ["10.150.10.81:9100"]
- job_name: "nshipa02"
static_configs:
- targets: ["10.150.10.82:9100"]
- job_name: "cnbjipanfs01"
static_configs:
- targets: ["10.151.10.32:9100"]
- job_name: "twvmipa01"
static_configs:
- targets: ["10.160.10.188:9100"]
- job_name: "twvmipa02"
static_configs:
- targets: ["10.160.10.189:9100"]
- job_name: "twvmipa03"
static_configs:
- targets: ["10.160.10.190:9100"]
- job_name: "twvmipa04"
static_configs:
- targets: ["10.160.10.191:9100"]
- job_name: "cnsznis01"
static_configs:
- targets: ["10.152.10.31:9100"]
- job_name: "cnshipa03"
static_configs:
- targets: ["10.150.10.86:9100"]
- job_name: "usdcnbackup01"
static_configs:
- targets: ["10.115.10.83:9100"]
- job_name: "USATNIS02"
static_configs:
- targets: ["10.108.10.14:9100"]
- job_name: "tcp_port_111_2049_check"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.152.10.118:111
- 10.153.10.30:111
- 10.153.10.30:2049
- 10.153.10.200:111
- 10.153.10.200:2049
- 10.150.111.240:111
- 10.150.111.240:2049
- 10.150.10.180:111
- 10.150.10.81:111
- 10.151.10.32:111
- 10.151.10.32:2049
- 10.152.10.31:111
- 10.152.10.31:2049
- 10.150.10.86:111
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnshipa04"
static_configs:
- targets: ["10.150.10.87:9100"]
# FreeIPA LDAP 389明文 / 636加密端口连通探测
- job_name: "blackbox-freeipa-ldap"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.150.10.81:389
- 10.150.10.82:389
- 10.150.10.86:389
- 10.150.10.87:389
- 10.160.10.188:389
- 10.160.10.189:389
- 10.160.10.190:389
- 10.160.10.191:389
- 10.152.10.118:389
- 10.153.10.30:389
- 10.151.10.31:389
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnbjipa01"
static_configs:
- targets: ["10.151.10.31:9100"]
- job_name: consul-sd
consul_sd_configs:
- server: 10.150.117.190:8500
tags: ["metrics"]
relabel_configs:
- source_labels: [__meta_consul_health]
regex: passing
action: keep
- source_labels: [__meta_consul_service]
target_label: service
- source_labels: [__meta_consul_address, __meta_consul_service_port]
separator: ":"
target_label: instance
- job_name: "cnshnis01_systemd"
static_configs:
- targets: ["10.150.10.180:9558"]
- job_name: "cnshipa01_systemd"
static_configs:
- targets: ["10.150.10.81:9558"]
- job_name: "cnshipa02_systemd"
static_configs:
- targets: ["10.150.10.82:9558"]
- job_name: "cnshipa03_systemd"
static_configs:
- targets: ["10.150.10.86:9558"]
- job_name: "cnshipa04_systemd"
static_configs:
- targets: ["10.150.10.87:9558"]
- job_name: "nsschina2_systemd"
static_configs:
- targets: ["10.150.111.240:9558"]
- job_name: "cnbjipa01_systemd"
static_configs:
- targets: ["10.151.10.31:9558"]
- job_name: "cnbjipanfs01_systemd"
static_configs:
- targets: ["10.151.10.32:9558"]
- job_name: "cnszipa01_systemd"
static_configs:
- targets: ["10.152.10.118:9558"]
- job_name: "twvmipa01_systemd"
static_configs:
- targets: ["10.160.10.188:9558"]
- job_name: "twvmipa02_systemd"
static_configs:
- targets: ["10.160.10.189:9558"]
- job_name: "twvmipa04_systemd"
static_configs:
- targets: ["10.160.10.191:9558"]
-192
View File
@@ -1,192 +0,0 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_timeout: 8s
alerting:
alertmanagers:
- static_configs:
- targets:
- "10.150.117.190:9093"
rule_files:
- "/etc/prometheus/rules/*.yml"
scrape_configs:
- job_name: "cnszipa01"
static_configs:
- targets: ["10.152.10.118:9100"]
- job_name: "cnxaipa01"
static_configs:
- targets: ["10.153.10.30:9100"]
- job_name: "cnxanis01"
static_configs:
- targets: ["10.153.10.200:9100"]
- job_name: "nsschina2"
static_configs:
- targets: ["10.150.111.240:9100"]
- job_name: 'veeam-builtin'
static_configs:
- targets: ['10.150.117.224:9182']
scrape_interval: 60s
- job_name: 'pushgateway'
static_configs:
- targets: ['10.150.117.190:9091']
- job_name: "prometheus"
static_configs:
- targets: ["10.150.117.190:9100"]
- job_name: "nsschina"
static_configs:
- targets: ["10.150.10.180:9100"]
- job_name: "cnshipa01"
static_configs:
- targets: ["10.150.10.81:9100"]
- job_name: "nshipa02"
static_configs:
- targets: ["10.150.10.82:9100"]
- job_name: "cnbjipanfs01"
static_configs:
- targets: ["10.151.10.32:9100"]
- job_name: "twvmipa01"
static_configs:
- targets: ["10.160.10.188:9100"]
- job_name: "twvmipa02"
static_configs:
- targets: ["10.160.10.189:9100"]
- job_name: "twvmipa03"
static_configs:
- targets: ["10.160.10.190:9100"]
- job_name: "twvmipa04"
static_configs:
- targets: ["10.160.10.191:9100"]
- job_name: "cnsznis01"
static_configs:
- targets: ["10.152.10.31:9100"]
- job_name: "cnshipa03"
static_configs:
- targets: ["10.150.10.86:9100"]
- job_name: "usdcnbackup01"
static_configs:
- targets: ["10.115.10.83:9100"]
- job_name: "USATNIS02"
static_configs:
- targets: ["10.108.10.14:9100"]
- job_name: "tcp_port_111_2049_check"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.152.10.118:111
- 10.153.10.30:111
- 10.153.10.30:2049
- 10.153.10.200:111
- 10.153.10.200:2049
- 10.150.111.240:111
- 10.150.111.240:2049
- 10.150.10.180:111
- 10.150.10.81:111
- 10.151.10.32:111
- 10.151.10.32:2049
- 10.152.10.31:111
- 10.152.10.31:2049
- 10.150.10.86:111
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnshipa04"
static_configs:
- targets: ["10.150.10.87:9100"]
# FreeIPA LDAP 389明文 / 636加密端口连通探测
- job_name: "blackbox-freeipa-ldap"
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.150.10.81:389
- 10.150.10.82:389
- 10.150.10.86:389
- 10.150.10.87:389
- 10.160.10.188:389
- 10.160.10.189:389
- 10.160.10.190:389
- 10.160.10.191:389
- 10.152.10.118:389
- 10.153.10.30:389
- 10.151.10.31:389
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.150.117.190:9115
- source_labels: [__param_target]
regex: .+:(\d+)
target_label: port
- job_name: "cnbjipa01"
static_configs:
- targets: ["10.151.10.31:9100"]
- job_name: consul-sd
consul_sd_configs:
- server: 10.150.117.190:8500
tags: ["metrics"]
relabel_configs:
- source_labels: [__meta_consul_health]
regex: passing
action: keep
- source_labels: [__meta_consul_service]
target_label: service
- source_labels: [__meta_consul_address, __meta_consul_service_port]
separator: ":"
target_label: instance
- job_name: "cnshnis01_systemd"
static_configs:
- targets: ["10.150.10.180:9558"]
- job_name: "cnshipa01_systemd"
static_configs:
- targets: ["10.150.10.81:9558"]
- job_name: "cnshipa02_systemd"
static_configs:
- targets: ["10.150.10.82:9558"]
- job_name: "cnshipa03_systemd"
static_configs:
- targets: ["10.150.10.86:9558"]
- job_name: "cnshipa04_systemd"
static_configs:
- targets: ["10.150.10.87:9558"]
- job_name: "nsschina2_systemd"
static_configs:
- targets: ["10.150.111.240:9558"]
- job_name: "cnbjipa01_systemd"
static_configs:
- targets: ["10.151.10.31:9558"]
- job_name: "cnbjipanfs01_systemd"
static_configs:
- targets: ["10.151.10.32:9558"]
- job_name: "cnszipa01_systemd"
static_configs:
- targets: ["10.152.10.118:9558"]
- job_name: "twvmipa01_systemd"
static_configs:
- targets: ["10.160.10.188:9558"]
- job_name: "twvmipa02_systemd"
static_configs:
- targets: ["10.160.10.189:9558"]
- job_name: "twvmipa04_systemd"
static_configs:
- targets: ["10.160.10.191:9558"]
- job_name: "twvmipa03_systemd"
static_configs:
- targets: ["10.160.10.190:9558"]
View File
-57
View File
@@ -1,57 +0,0 @@
groups:
- name: single_port_service_alarm
rules:
########################### 严重告警 Critical ###########################
# 22 sshd 远程登录端口
- alert: Port_22_SSHD_Down
expr: probe_success{port="22"} == 0
for: 10s
labels:
severity: critical
service: sshd
annotations:
summary: "主机{{$labels.instance}} SSH登录端口{{$labels.port}}断开"
description: "端口{{$labels.port}} sshd服务异常,无法远程登录服务器,紧急处理!"
# 111 rpcbind RPC注册服务
- alert: Port_111_Rpcbind_Down
expr: probe_success{port="111"} == 0
for: 10s
labels:
severity: critical
service: rpcbind
annotations:
summary: "主机{{$labels.instance}} RPC注册端口{{$labels.port}}断开"
description: "端口{{$labels.port}} rpcbind异常,所有NFS/RPC相关服务全部失效,业务挂载会报错!"
# 2049 NFS存储端口
- alert: Port_2049_NFS_Down
expr: probe_success{port="2049"} == 0
for: 10s
labels:
severity: critical
service: nfs
annotations:
summary: "主机{{$labels.instance}} NFS存储端口{{$labels.port}}断开"
description: "端口{{$labels.port}} NFS内核端口无法连通,所有业务NFS读写中断!"
# 9100 node_exporter监控采集
- alert: Port_9100_NodeExporter_Down
expr: probe_success{port="9100"} == 0
for: 10s
labels:
severity: critical
service: node_exporter
annotations:
summary: "主机{{$labels.instance}} 监控采集端口{{$labels.port}}断开"
description: "端口{{$labels.port}} node_exporter离线,主机资源指标无法采集,无监控数据!"
########################### 通用端口延迟告警 ###########################
- alert: Port_High_Latency
expr: probe_duration_seconds > 0.5
for: 1m
labels:
severity: warning
annotations:
summary: "主机{{$labels.instance}} {{$labels.service}}端口{{$labels.port}}连接延迟过高"
description: "端口{{$labels.port}}服务{{$labels.service}}网络耗时超过500ms,网络存在拥塞"
-133
View File
@@ -1,133 +0,0 @@
groups:
- name: freeipa_alerts
rules:
# 1. FreeIPA 节点宕机 / node_exporter 挂了
- alert: FreeIPA_Node_Down
expr: up{job=~"freeipa|ipa"} == 0
for: 30s
labels:
severity: critical
annotations:
summary: "FreeIPA 节点失联"
description: "节点 {{ $labels.instance }} node-exporter 掉线超过30秒,主机不可达"
# 2. FreeIPA 核心综合服务异常(krb5kdc/httpd/ipa-custodia/pki-tomcatd
- alert: FreeIPA_Service_Down
expr: sum by(instance,name) (node_systemd_unit_state{name=~"krb5kdc.service|httpd.service|ipa-custodia.service|pki-tomcatd@.*.service",state="active"}) != 1
for: 1m
labels:
severity: critical
annotations:
summary: "FreeIPA 核心服务异常停止"
description: "节点 {{ $labels.instance }} 服务 {{ $labels.name }} 未处于运行状态"
# 3. Kerberos KDC 认证服务异常
- alert: FreeIPA_Kerberos_Down
expr: sum by(instance,name) (node_systemd_unit_state{name="krb5kdc.service",state="active"}) != 1
for: 1m
labels:
severity: critical
annotations:
summary: "Kerberos KDC 认证服务异常"
description: "krb5kdc.service 停止,域用户无法完成Kerberos认证登录"
# 4. FreeIPA Web 管理界面 httpd 服务异常
- alert: FreeIPA_HTTP_Down
expr: sum by(instance,name) (node_systemd_unit_state{name="httpd.service",state="active"}) != 1
for: 1m
labels:
severity: critical
annotations:
summary: "FreeIPA Web 管理界面服务异常"
description: "httpd.service 已停止,无法访问IPA网页管理端"
# 5. PKI 证书签发服务 pki-tomcatd 异常
- alert: FreeIPA_PKI_Tomcat_Down
expr: sum by(instance,name) (node_systemd_unit_state{name=~"pki-tomcatd@.*.service",state="active"}) != 1
for: 2m
labels:
severity: warning
annotations:
summary: "FreeIPA PKI 证书服务异常"
description: "pki-tomcatd 证书签发服务停止,新证书无法申请下发"
# 6. 专属监控 dirsrv@ADVANTEST-COM.service 389 LDAP目录服务停机
- alert: DirsrvServiceDown
expr: sum by(instance,name) (node_systemd_unit_state{name="dirsrv@ADVANTEST-COM.service",state="active"}) != 1
for: 30s
labels:
severity: critical
service: dirsrv-ADVANTEST
annotations:
summary: "389 LDAP目录服务已停止"
description: "主机{{ $labels.instance }} dirsrv@ADVANTEST-COM.service 非运行状态,LDAP查询/认证失效,请立即检查"
# 7. LDAP 端口 389/636 探测不通
- alert: FreeIPA_LDAP_Port_Down
expr: probe_tcp_port{target=~".*:389|.*:636"} == 0
for: 30s
labels:
severity: critical
annotations:
summary: "LDAP 端口连通性异常"
description: "无法TCP连接 {{ $labels.target }},防火墙/服务异常"
# 8. Kerberos 88端口探测不通
- alert: FreeIPA_KRB5_Port_Down
expr: probe_tcp_port{target=~".*:88"} == 0
for: 30s
labels:
severity: critical
annotations:
summary: "Kerberos 88端口不通"
description: "目标 {{ $labels.target }} TCP88端口无法访问,Kerberos认证阻断"
# 9. 证书剩余 <30天 预警
- alert: FreeIPA_Certificate_Will_Expire
expr: ipa_cert_expiry_hours < 720
for: 1m
labels:
severity: warning
annotations:
summary: "FreeIPA 证书即将过期(剩余<30天)"
description: "证书 {{ $labels.cert }} 有效期剩余不足30天,请规划续期"
# 10. 证书剩余 <7天 紧急告警
- alert: FreeIPA_Certificate_Will_Expire_Critical
expr: ipa_cert_expiry_hours < 168
for: 1m
labels:
severity: critical
annotations:
summary: "FreeIPA 证书即将过期!紧急处理"
description: "证书 {{ $labels.cert }} 有效期剩余不足7天,逾期会导致域认证全部失效"
# 11. 内存使用率超过85%
- alert: FreeIPA_High_Memory_Usage
expr: 100 - (node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes * 100) > 85
for: 2m
labels:
severity: warning
annotations:
summary: "FreeIPA主机内存使用率过高"
description: "{{ $labels.instance }} 内存使用率 > 85%,存在OOM风险"
# 12. CPU使用率超过90%
- alert: FreeIPA_High_CPU_Usage
expr: 100 - (avg by(instance) (irate(node_cpu_seconds_total{mode="idle"}[2m])) * 100) > 90
for: 2m
labels:
severity: warning
annotations:
summary: "FreeIPA主机CPU使用率过高"
description: "{{ $labels.instance }} CPU持续占用高于90%,业务响应缓慢"
# 13. 根分区磁盘使用率超85%
- alert: FreeIPA_High_Disk_Usage
expr: 100 - (node_filesystem_avail_bytes{mountpoint="/"} / node_filesystem_size_bytes * 100) > 85
for: 2m
labels:
severity: warning
annotations:
summary: "主机根分区磁盘使用率过高"
description: "{{ $labels.instance }} / 分区磁盘占用 > 85%,请清理日志/扩容"
-104
View File
@@ -1,104 +0,0 @@
groups:
- name: node_live
rules:
- alert: NodeInstanceDown
expr: up{job=~".*node.*"} == 0
for: 30s
labels:
severity: critical
annotations:
summary: "服务器 {{ $labels.instance }} 监控失联"
description: "节点 {{ $labels.instance }} node_exporter 离线,服务器宕机或进程挂掉"
- name: cpu_alert
rules:
# CPU 使用率超过 85% 告警
- alert: CpuUsageHigh
expr: 100 - (avg by(instance) (irate(node_cpu_seconds_total{mode="idle"}[1m])) * 100) > 85
for: 2m
labels:
severity: warning
annotations:
summary: "服务器 {{ $labels.instance }} CPU 负载过高"
description: "CPU 当前使用率:{{ $value }}%"
- alert: CpuUsageCritical
expr: 100 - (avg by(instance) (irate(node_cpu_seconds_total{mode="idle"}[1m])) * 100) > 95
for: 1m
labels:
severity: critical
annotations:
summary: "服务器 {{ $labels.instance }} CPU 严重过载"
description: "CPU 当前使用率:{{ $value }}%"
- name: memory_alert
rules:
# 内存使用率 >85% 警告
- alert: MemoryUsageHigh
expr: (1 - (node_memory_MemFree_bytes + node_memory_Buffers_bytes + node_memory_Cached_bytes) / node_memory_MemTotal_bytes) * 100 > 85
for: 2m
labels:
severity: warning
annotations:
summary: "服务器 {{ $labels.instance }} 内存使用率过高"
description: "内存当前使用率:{{ $value }}%"
- alert: MemoryUsageCritical
expr: (1 - (node_memory_MemFree_bytes + node_memory_Buffers_bytes + node_memory_Cached_bytes) / node_memory_MemTotal_bytes) * 100 > 95
for: 1m
labels:
severity: critical
annotations:
summary: "服务器 {{ $labels.instance }} 内存严重不足"
description: "内存当前使用率:{{ $value }}%"
- name: disk_alert
rules:
# 专属 /serverhome 剩余小于100G 严重告警
- alert: ServerhomeDiskLess100G
expr: node_filesystem_avail_bytes{mountpoint="/serverhome"} < 100 * 1024 * 1024 * 1024
for: 1m
labels:
severity: critical
annotations:
summary: "/serverhome 分区剩余空间不足100GB"
description: "节点 {{ $labels.instance }} 挂载点 {{ $labels.mountpoint }} 剩余:{{ $value }} 字节"
# - alert: DiskAvailLess20G
# expr: node_filesystem_avail_bytes{mountpoint!~"^/(sys|proc|dev|tmp|boot|boot/efi|run)($|/)"} < 20 * 1024 * 1024 * 1024
# for: 1m
# labels:
# severity: warning
# annotations:
# summary: "挂载点 {{ $labels.mountpoint }} 剩余空间不足20GB"
# description: "节点 {{ $labels.instance }} 剩余:{{ $value }} 字节"
#
# - alert: DiskUsageOver90
# expr: (100 - (node_filesystem_avail_bytes{mountpoint!~"^/(sys|proc|dev|tmp|boot|boot/efi|run)($|/)"} / node_filesystem_size_bytes * 100)) > 90 and instance!="10.150.111.240:9100" and instance!="10.153.10.200:9100"
# for: 2m
# labels:
# severity: critical
# annotations:
# summary: "挂载点 {{ $labels.mountpoint }} 磁盘使用率超过90%"
# description: "节点 {{ $labels.instance }} 使用率:{{ $value }}%"
- name: network_alert
rules:
# 网卡入流量 峰值过大
- alert: NetworkInHigh
expr: avg by(instance,device) (irate(node_network_receive_bytes_total{device!~"lo"}[1m])) / 1024 / 1024 > 80
for: 1m
labels:
severity: warning
annotations:
summary: "服务器 {{ $labels.instance }} 网卡 {{ $labels.device }} 入流量过高"
description: "当前入流量:{{ $value }} MB/s"
# 网卡出流量 峰值过大
- alert: NetworkOutHigh
expr: avg by(instance,device) (irate(node_network_transmit_bytes_total{device!~"lo"}[1m])) / 1024 / 1024 > 80
for: 1m
labels:
severity: warning
annotations:
summary: "服务器 {{ $labels.instance }} 网卡 {{ $labels.device }} 出流量过高"
description: "当前出流量:{{ $value }} MB/s"
-30
View File
@@ -1,30 +0,0 @@
groups:
- name: tcp_port_down_rules
rules:
- alert: NIS Service Down
expr: probe_success{port="111"} == 0
for: 10s
labels:
severity: critical
port: "111"
annotations:
summary: "主机 {{$labels.instance}} RPC 111端口不可达"
description: "111(rpcbind/NIS)端口断开,NIS/NFS依赖异常,实例:{{$labels.instance}},端口:111"
- alert: NFS Service Down
expr: probe_success{port="2049"} == 0
for: 10s
labels:
severity: critical
port: "2049"
annotations:
summary: "主机 {{$labels.instance}} NFS 2049端口不可达"
description: "2049(NFS服务)端口断开,NFS挂载访问失败,实例:{{$labels.instance}},端口:2049"
- alert: 389 Port Down
expr: probe_success{port="389"} == 0
for: 10s
labels:
severity: critical
port: "389"
annotations:
summary: "主机 {{$labels.instance}} 认证 389端口不可达"
-88
View File
@@ -1,88 +0,0 @@
groups:
- name: Linux-Base-Alert
rules:
# 节点离线 = Failed
- alert: Host_Down_Failed
expr: up == 0
for: 30s
labels:
severity: critical
level: Failed
annotations:
summary: "❌ 节点离线 Failed"
description: |
主机:{{ $labels.instance }}
任务:{{ $labels.job }}
- alert: Host_Ping_Offline
expr: probe_success{job=~"blackbox_icmp.*"} == 0
for: 1m
labels:
severity: critical
level: Down
annotations:
summary: "主机 Ping 失联 {{ $labels.instance }}"
description: "主机网络不通,ICMP探测失败,大概率整机宕机或网段隔离"
- alert: Port_Down
expr: probe_success{port!=""} == 0
for: 1m
labels:
severity: critical
level: Down
annotations:
summary: "端口 {{ $labels.port }} 通信异常 {{ $labels.instance }}"
description: |
业务:{{ $labels.business }}
监控任务:{{ $labels.job }}
故障地址:{{ $labels.instance }}
异常端口:{{ $labels.port }}
# CPU 警告 Warning
- alert: CPU_High_Warning
expr: 100 - (avg by(instance) (irate(node_cpu_seconds_total{mode="idle"}[2m])) * 100) > 80
for: 3m
labels:
severity: warning
level: Warning
annotations:
summary: "⚠️ CPU 负载过高 Warning"
description: "主机 {{ $labels.instance }} CPU 使用率:{{ printf \"%.2f\" $value }} %"
# 内存严重 Failed
- alert: Mem_High_Failed
expr: 100 - (node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes * 100) > 90
for: 3m
labels:
severity: critical
level: Failed
annotations:
summary: "❌ 内存占用过高 Failed"
description: "主机 {{ $labels.instance }} 内存使用率:{{ printf \"%.2f\" $value }} %"
# 磁盘警告 Warning
- alert: Disk_High_Warning
expr: 100 - (node_filesystem_avail_bytes{mountpoint="/"} / node_filesystem_size_bytes * 100) > 85
for: 2m
labels:
severity: warning
level: Warning
annotations:
summary: "⚠️ 磁盘空间不足 Warning"
description: "分区 {{ $labels.mountpoint }} 使用率:{{ printf \"%.2f\" $value }} %"
- name: FreeIPA-Alert
rules:
# FreeIPA 核心服务异常 Failed
- alert: FreeIPA_Service_Failed
expr: node_systemd_unit_state{name=~"ipa|dirsrv|krb5kdc|httpd|pki-tomcatd|sssd",state="active"} == 0
for: 60s
labels:
severity: critical
level: Failed
annotations:
summary: "❌ FreeIPA 服务异常 Failed"
description: |
故障主机:{{ $labels.instance }}
异常服务:{{ $labels.name }}
影响:域认证、LDAP、登录挂载异常
-15
View File
@@ -1,15 +0,0 @@
services:
consul:
image: hashicorp/consul
container_name: consul
ports:
- "8500:8500"
- "8600:8600/udp"
volumes:
- consul-data:/consul/data
- ./consul-config:/consul/config
command: agent -server -bootstrap -ui -client=0.0.0.0
restart: always
volumes:
consul-data:
-99
View File
@@ -1,99 +0,0 @@
version: '3.8'
services:
prometheus:
image: prom/prometheus:v2.36.2
container_name: prometheus
volumes:
- ./conf/prometheus.yml:/etc/prometheus/prometheus.yml
- ./conf/rules:/etc/prometheus/rules
- prometheus_data:/prometheus
ports:
- "9090:9090"
command:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--web.enable-lifecycle"
- "--storage.tsdb.retention.time=180d"
- "--query.max-samples=2000000"
restart: unless-stopped
extra_hosts:
- "master:10.0.0.87"
- "node1:10.0.0.81"
- "node2:10.0.0.82"
pushgateway:
image: prom/pushgateway:v1.5.0
container_name: pushgateway
ports:
- "9091:9091"
restart: unless-stopped
extra_hosts:
- "master:10.0.0.87"
- "node1:10.0.0.81"
- "node2:10.0.0.82"
alertmanager:
image: prom/alertmanager:v0.27.0
container_name: alertmanager
restart: unless-stopped
network_mode: host
volumes:
- ./alertmanager/alertmanager.yml:/etc/alertmanager/alertmanager.yml
- ./alertmanager/templates:/etc/alertmanager/templates
- alertmanager_data:/alertmanager
- /etc/localtime:/etc/localtime
- /etc/timezone:/etc/timezone
command:
- "--config.file=/etc/alertmanager/alertmanager.yml"
- "--storage.path=/alertmanager"
- "--storage.retention=148h"
- "--cluster.listen-address="
- "--cluster.advertise-address="
cap_add:
- CAP_SYS_TIME
extra_hosts:
- "master:10.0.0.87"
- "node1:10.0.0.81"
- "node2:10.0.0.82"
prometheus-alert:
image: feiyu563/prometheus-alert:master
container_name: prometheus-alert
restart: unless-stopped
ports:
- "9094:8080"
volumes:
- prometheus_alert_data:/app
environment:
- PA_LOGIN_USER=alertuser
- PA_LOGIN_PASSWORD=123456
- PA_TITLE=prometheusAlert
- PA_OPEN_FEISHU=1
- PA_OPEN_DINGDING=0
- PA_OPEN_WEIXIN=1
extra_hosts:
- "master:10.0.0.87"
- "node1:10.0.0.81"
- "node2:10.0.0.82"
grafana:
image: grafana/grafana:9.1.2
container_name: grafana
network_mode: host
environment:
- GF_SECURITY_ADMIN_PASSWORD=Advantest#1
volumes:
- grafana_data:/var/lib/grafana
ports:
- "3000:3000"
restart: unless-stopped
extra_hosts:
- "master:10.0.0.87"
- "node1:10.0.0.81"
- "node2:10.0.0.82"
volumes:
prometheus_data:
prometheus_alert_data:
alertmanager_data:
grafana_data:
-79
View File
@@ -1,79 +0,0 @@
services:
prometheus:
image: prom/prometheus:v2.36.2
container_name: prometheus
volumes:
- ./conf/prometheus.yml:/etc/prometheus/prometheus.yml
- ./conf/rules:/etc/prometheus/rules
- prometheus_data:/prometheus
ports:
- "9090:9090"
command:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--web.enable-lifecycle"
restart: unless-stopped
extra_hosts:
- "master:10.0.0.87"
- "node1:10.0.0.81"
- "node2:10.0.0.82"
pushgateway:
image: prom/pushgateway:v1.5.0
container_name: pushgateway
ports:
- "9091:9091"
restart: unless-stopped
extra_hosts:
- "master:10.0.0.87"
- "node1:10.0.0.81"
- "node2:10.0.0.82"
alertmanager:
image: prom/alertmanager:v0.25.0
container_name: alertmanager
restart: unless-stopped
ports:
- "9093:9093"
volumes:
- alertmanager_data:/etc/alertmanager
extra_hosts:
- "master:10.0.0.87"
- "node1:10.0.0.81"
- "node2:10.0.0.82"
prometheus-alert:
image: feiyu563/prometheus-alert:master
container_name: prometheus-alert
restart: unless-stopped
ports:
- "9094:8080"
volumes:
- prometheus_alert_data:/app
environment:
- PA_LOGIN_USER=alertuser
- PA_LOGIN_PASSWORD=123456
- PA_TITLE=prometheusAlert
- PA_OPEN_FEISHU=1
- PA_OPEN_DINGDING=0
- PA_OPEN_WEIXIN=1
extra_hosts:
- "master:10.0.0.87"
- "node1:10.0.0.81"
- "node2:10.0.0.82"
grafana:
image: grafana/grafana:9.1.2
container_name: grafana
environment:
- GF_SECURITY_ADMIN_PASSWORD=Advantest#1
volumes:
- grafana_data:/var/lib/grafana
ports:
- "3000:3000"
restart: unless-stopped
extra_hosts:
- "master:10.0.0.87"
- "node1:10.0.0.81"
- "node2:10.0.0.82"
volumes:
prometheus_conf:
prometheus_data:
prometheus_alert_data:
alertmanager_data:
grafana_data:
File diff suppressed because it is too large Load Diff
-32
View File
@@ -1,32 +0,0 @@
#!/usr/bin/env python3
from flask import Flask, request
import json
import time
import requests
app = Flask(__name__)
LOKI_PUSH = "http://127.0.0.1:3100/loki/api/v1/push"
@app.route("/alert-relay", methods=["POST"])
def handle_alert():
# 接收Alertmanager告警
am_raw = request.get_json()
# 转Loki标准推送格式
payload = {
"streams": [
{
"stream": {"job": "alertmanager"},
"values": [
# 纳秒级时间戳 + 告警完整json字符串
[str(int(time.time() * 1000000000)), json.dumps(am_raw)]
]
}
]
}
# 推送到Loki
requests.post(LOKI_PUSH, json=payload)
return "success", 200
if __name__ == "__main__":
# 仅本地127.0.0.1监听9080,外部无法访问
app.run(host="127.0.0.1", port=9081, debug=False)
-23
View File
@@ -1,23 +0,0 @@
services:
loki:
image: grafana/loki:2.9.9
container_name: loki
network_mode: host
volumes:
- loki-data:/loki
command: -config.file=/etc/loki/local-config.yaml
restart: always
promtail:
image: grafana/promtail:2.9.0
container_name: promtail
network_mode: host
volumes:
- ./promtail.yml:/etc/promtail/promtail.yml:ro
- promtail-pos:/var/lib/promtail
command: -config.file=/etc/promtail/promtail.yml
restart: always
volumes:
loki-data:
promtail-pos:
-53
View File
@@ -1,53 +0,0 @@
auth_enabled: false
server:
http_listen_port: 3100
grpc_listen_port: 9096
ingester:
wal:
enabled: true
dir: /loki/wal
lifecycler:
address: 10.150.117.190
ring:
kvstore:
store: inmemory
replication_factor: 1
final_sleep: 0s
chunk_idle_period: 1h
max_chunk_age: 1h
chunk_target_size: 1048576
chunk_retain_period: 30s
max_transfer_retries: 0
schema_config:
configs:
- from: 2020-10-24
store: boltdb-shipper
object_store: filesystem
schema: v11
index:
prefix: index_
period: 24h
storage_config:
boltdb_shipper:
active_index_directory: /loki/boltdb-shipper-active
cache_location: /loki/boltdb-shipper-cache
cache_ttl: 24h
shared_store: filesystem
filesystem:
directory: /loki/chunks
limits_config:
enforce_metric_name: false
reject_old_samples: true
reject_old_samples_max_age: 168h
chunk_store_config:
max_look_back_period: 0s
table_manager:
retention_deletes_enabled: false
retention_period: 0s
-12
View File
@@ -1,12 +0,0 @@
server:
http_listen_port: 9080
grpc_listen_port: 0
positions:
filename: /var/lib/promtail/positions.yaml
clients:
- url: http://10.150.117.190:3100/loki/api/v1/push
# 我们不用采集日志文件,scrape_configs留空即可
scrape_configs: []
-7
View File
@@ -1,7 +0,0 @@
nohup: ignoring input
* Serving Flask app "alert-relay" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://127.0.0.1:9081/ (Press CTRL+C to quit)
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+115
View File
@@ -0,0 +1,115 @@
# 引入 Veeam 的 PowerShell 模块
Add-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue
# 配置 Pushgateway 的地址、Job名称和当前实例名
$PushgatewayUrl = "http://10.150.117.190:9091"
$JobName = "veeam_backup"
$InstanceName = $env:COMPUTERNAME
# 定义指标保存路径:当前目录下的 veeam_metrics.prom
$OutputFile = Join-Path -Path $PWD.Path -ChildPath "veeam_metrics.prom"
# ================== Linux 上传配置 ==================
$linuxUser = "root"
$linuxIP = "10.150.117.190"
$linuxPath = "/opt/prom_textfile/"
$localFile = ".\veeam_metrics.prom"
# ================== 无限循环:每分钟执行一次 ==================
while ($true) {
$Metrics = @()
# Prometheus 标准头部
$Metrics += "# HELP veeam_job_status Veeam backup job status (0=Success,1=Warning,2=Failed,3=None)"
$Metrics += "# TYPE veeam_job_status gauge"
$Metrics += "# HELP veeam_job_is_running Veeam job is running (1=running,0=idle)"
$Metrics += "# TYPE veeam_job_is_running gauge"
$Metrics += "# HELP veeam_job_progress_percent Veeam job progress percentage"
$Metrics += "# TYPE veeam_job_progress_percent gauge"
$Metrics += "# HELP veeam_job_backup_size_gb Veeam backup size in GB"
$Metrics += "# TYPE veeam_job_backup_size_gb gauge"
$Metrics += "# HELP veeam_job_data_size_gb Veeam data size processed in GB"
$Metrics += "# TYPE veeam_job_data_size_gb gauge"
$Metrics += "# HELP veeam_job_duration_seconds Veeam job duration in seconds"
$Metrics += "# TYPE veeam_job_duration_seconds gauge"
$Metrics += "# HELP veeam_repo_free_space_gb Veeam repository free space in GB"
$Metrics += "# TYPE veeam_repo_free_space_gb gauge"
$Metrics += "# HELP veeam_repo_total_space_gb Veeam repository total space in GB"
$Metrics += "# TYPE veeam_repo_total_space_gb gauge"
$Metrics += ""
# ================== 1. 抓取备份任务指标 ==================
$Jobs = Get-VBRJob | Where-Object { $_.JobType -eq "Backup" }
foreach ($Job in $Jobs) {
$LastSession = $Job.FindLastSession()
$Status = if ($LastSession) { $LastSession.Result } else { "None" }
$State = if ($LastSession) { $LastSession.State } else { "Idle" }
$StatusCode = switch ($Status) {
"Success" { 0 }
"Warning" { 1 }
"Failed" { 2 }
default { 3 }
}
$IsRunning = if ($State -eq "Working") { 1 } else { 0 }
$SafeJobName = $Job.Name -replace '[^a-zA-Z0-9_]', '_'
$CleanJobName = $SafeJobName -replace '[`"''\n\r]', ''
$Metrics += "veeam_job_status{job=`"$JobName`", instance=`"$InstanceName`", job_name=`"$CleanJobName`"} $StatusCode"
$Metrics += "veeam_job_is_running{job=`"$JobName`", instance=`"$InstanceName`", job_name=`"$CleanJobName`"} $IsRunning"
$Progress = if ($LastSession -and $State -eq "Working") { $LastSession.Progress.Percents } else { 0 }
$Metrics += "veeam_job_progress_percent{job=`"$JobName`", instance=`"$InstanceName`", job_name=`"$CleanJobName`"} $Progress"
$BackupSizeGB = if ($LastSession) { [math]::Round($LastSession.Info.Progress.BackupSize / 1GB, 2) } else { 0 }
$Metrics += "veeam_job_backup_size_gb{job=`"$JobName`", instance=`"$InstanceName`", job_name=`"$CleanJobName`"} $BackupSizeGB"
$DataSizeGB = if ($LastSession) { [math]::Round($LastSession.Info.Progress.DataSize / 1GB, 2) } else { 0 }
$Metrics += "veeam_job_data_size_gb{job=`"$JobName`", instance=`"$InstanceName`", job_name=`"$CleanJobName`"} $DataSizeGB"
$DurationSeconds = if ($LastSession -and $LastSession.EndTime) {
($LastSession.EndTime - $LastSession.CreationTime).TotalSeconds
} else { 0 }
$Metrics += "veeam_job_duration_seconds{job=`"$JobName`", instance=`"$InstanceName`", job_name=`"$CleanJobName`"} $DurationSeconds"
}
# ================== 2. 抓取备份存储库空间指标 ==================
$Repositories = Get-VBRBackupRepository
foreach ($Repo in $Repositories) {
$Path = $Repo.Path
$DriveLetter = (Split-Path $Path -Qualifier).TrimEnd(':')
$DiskInfo = Get-WmiObject Win32_LogicalDisk -Filter "DeviceID='$DriveLetter`:'" -ErrorAction SilentlyContinue
if ($DiskInfo) {
$FreeSpaceGB = [math]::Round($DiskInfo.FreeSpace / 1GB, 2)
$TotalSpaceGB = [math]::Round($DiskInfo.Size / 1GB, 2)
} else {
$FreeSpaceGB = 0
$TotalSpaceGB = 0
}
$SafeRepoName = $Repo.Name -replace '[^a-zA-Z0-9_]', '_'
$CleanRepoName = $SafeRepoName -replace '[`"''\n\r]', ''
$Metrics += "veeam_repo_free_space_gb{job=`"$JobName`", instance=`"$InstanceName`", repo_name=`"$CleanRepoName`"} $FreeSpaceGB"
$Metrics += "veeam_repo_total_space_gb{job=`"$JobName`", instance=`"$InstanceName`", repo_name=`"$CleanRepoName`"} $TotalSpaceGB"
}
# ================== ✅ 最后加一行空行,满足 node_exporter 要求 ==================
$Metrics += ""
# ================== 输出纯 Linux 格式 ==================
$MetricsBody = $Metrics -join "`n"
[System.IO.File]::WriteAllText($OutputFile, $MetricsBody, [System.Text.UTF8Encoding]::new($false))
# ================== 上传 Linux ==================
scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=NUL $localFile "${linuxUser}@${linuxIP}:${linuxPath}"
Write-Host "`n✅ [$((Get-Date).ToString('yyyy-MM-dd HH:mm:ss'))] 采集完成并上传 → 等待 60 秒后下一次`n" -ForegroundColor Green
Start-Sleep -Seconds 60
}
+201
View File
@@ -0,0 +1,201 @@
# 完全兼容你的环境
Add-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue
# 配置项
$JobName = "veeam_backup"
$InstanceName = $env:COMPUTERNAME
$OutputFile = Join-Path -Path $PWD.Path -ChildPath "veeam_metrics.prom"
# Linux 上传配置
$linuxUser = "root"
$linuxIP = "10.150.117.190"
$linuxPath = "/opt/prom_textfile/"
$localFile = ".\veeam_metrics.prom"
while ($true) {
$Metrics = @()
$TodayStart = (Get-Date).Date
$GlobalTotalJobs = 0
$GlobalSuccessJobs = 0
$GlobalFailedJobs = 0
$GlobalRunningJobs = 0
$GlobalDailyTotalBackup = 0
# ================== 指标头部 ==================
$Metrics += "# HELP veeam_job_status Veeam backup job status (0=Success,1=Warning,2=Failed,3=None)"
$Metrics += "# TYPE veeam_job_status gauge"
$Metrics += "# HELP veeam_job_is_running Veeam job is running (1=running,0=idle)"
$Metrics += "# TYPE veeam_job_is_running gauge"
$Metrics += "# HELP veeam_job_progress_percent Veeam job progress percentage"
$Metrics += "# TYPE veeam_job_progress_percent gauge"
$Metrics += "# HELP veeam_job_backup_size_gb Veeam last backup size in GB"
$Metrics += "# TYPE veeam_job_backup_size_gb gauge"
$Metrics += "# HELP veeam_job_data_size_gb Veeam last processed data size in GB"
$Metrics += "# TYPE veeam_job_data_size_gb gauge"
$Metrics += "# HELP veeam_job_duration_seconds Veeam last job duration in seconds"
$Metrics += "# TYPE veeam_job_duration_seconds gauge"
$Metrics += "# HELP veeam_job_daily_backup_size_gb Veeam job total backup size today in GB"
$Metrics += "# TYPE veeam_job_daily_backup_size_gb gauge"
$Metrics += "# HELP veeam_repo_free_space_gb Veeam repository free space in GB"
$Metrics += "# TYPE veeam_repo_free_space_gb gauge"
$Metrics += "# HELP veeam_repo_total_space_gb Veeam repository total space in GB"
$Metrics += "# TYPE veeam_repo_total_space_gb gauge"
# 全局统计指标
$Metrics += "# HELP veeam_global_total_jobs Total number of Veeam backup jobs"
$Metrics += "# TYPE veeam_global_total_jobs gauge"
$Metrics += "# HELP veeam_global_success_jobs Number of successful Veeam backup jobs"
$Metrics += "# TYPE veeam_global_success_jobs gauge"
$Metrics += "# HELP veeam_global_failed_jobs Number of failed Veeam backup jobs"
$Metrics += "# TYPE veeam_global_failed_jobs gauge"
$Metrics += "# HELP veeam_global_running_jobs Number of running Veeam backup jobs"
$Metrics += "# TYPE veeam_global_running_jobs gauge"
$Metrics += "# HELP veeam_global_daily_total_gb Total backup size of all jobs today in GB"
$Metrics += "# TYPE veeam_global_daily_total_gb gauge"
$Metrics += "# HELP veeam_global_success_rate Overall backup success rate today (0-100)"
$Metrics += "# TYPE veeam_global_success_rate gauge"
# 单任务健康度指标
$Metrics += "# HELP veeam_job_last_success_timestamp Last successful backup timestamp (Unix seconds)"
$Metrics += "# TYPE veeam_job_last_success_timestamp gauge"
$Metrics += "# HELP veeam_job_since_last_success_hours Hours since last successful backup"
$Metrics += "# TYPE veeam_job_since_last_success_hours gauge"
$Metrics += "# HELP veeam_job_compression_ratio Backup compression ratio (data_size/backup_size)"
$Metrics += "# TYPE veeam_job_compression_ratio gauge"
# 存储智能预警指标
$Metrics += "# HELP veeam_repo_usage_percent Repository usage percentage (0-100)"
$Metrics += "# TYPE veeam_repo_usage_percent gauge"
$Metrics += "# HELP veeam_repo_remaining_days Estimated remaining days based on daily backup rate"
$Metrics += "# TYPE veeam_repo_remaining_days gauge"
$Metrics += ""
# ================== 1. 备份任务指标 ==================
$Jobs = Get-VBRJob | Where-Object { $_.JobType -eq "Backup" }
$GlobalTotalJobs = $Jobs.Count
$AllSessions = Get-VBRBackupSession
$Now = Get-Date # 提前获取当前时间,避免循环中多次调用
foreach ($Job in $Jobs) {
$LastSession = $Job.FindLastSession()
$Status = if ($LastSession) { $LastSession.Result } else { "None" }
$State = if ($LastSession) { $LastSession.State } else { "Idle" }
$StatusCode = switch ($Status) {
"Success" { 0; $GlobalSuccessJobs++ }
"Warning" { 1; $GlobalSuccessJobs++ }
"Failed" { 2; $GlobalFailedJobs++ }
default { 3 }
}
$IsRunning = if ($State -eq "Working") { 1; $GlobalRunningJobs++ } else { 0 }
$CleanJobName = $Job.Name -replace '[^a-zA-Z0-9_]', '_' -replace '[\r\n`"''"]', ''
# 基础指标
$Metrics += "veeam_job_status{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $StatusCode"
$Metrics += "veeam_job_is_running{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $IsRunning"
$Metrics += "veeam_job_progress_percent{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $(if($LastSession-and$State-eq'Working'){$LastSession.Progress.Percents}else{0})"
# 备份大小和数据量(兼容所有版本)
if ($LastSession) {
if ($State -eq "Working") {
$BackupSizeGB = if ($LastSession.Info.Progress.BackupSize) { [math]::Round($LastSession.Info.Progress.BackupSize / 1GB, 2) } else { 0 }
$DataSizeGB = if ($LastSession.Info.Progress.DataSize) { [math]::Round($LastSession.Info.Progress.DataSize / 1GB, 2) } else { 0 }
} else {
$BackupSizeGB = if ($LastSession.BackupStats.BackupSize) { [math]::Round($LastSession.BackupStats.BackupSize / 1GB, 2) } else { 0 }
$DataSizeGB = if ($LastSession.BackupStats.DataSize) { [math]::Round($LastSession.BackupStats.DataSize / 1GB, 2) } else { 0 }
}
$DurationSeconds = if ($LastSession.EndTime -and $LastSession.CreationTime) { [math]::Round(($LastSession.EndTime - $LastSession.CreationTime).TotalSeconds, 2) } else { 0 }
} else {
$BackupSizeGB = 0
$DataSizeGB = 0
$DurationSeconds = 0
}
$Metrics += "veeam_job_backup_size_gb{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $BackupSizeGB"
$Metrics += "veeam_job_data_size_gb{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $DataSizeGB"
$Metrics += "veeam_job_duration_seconds{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $DurationSeconds"
# 当日备份量
$TodaySessions = $AllSessions | Where-Object { $_.JobId -eq $Job.Id -and $_.CreationTime -ge $TodayStart }
$DailyBackupSizeGB = 0
foreach ($Session in $TodaySessions) {
if ($Session.BackupStats.BackupSize) {
$DailyBackupSizeGB += $Session.BackupStats.BackupSize / 1GB
}
}
$DailyBackupSizeGB = [math]::Round($DailyBackupSizeGB, 2)
$GlobalDailyTotalBackup += $DailyBackupSizeGB
$Metrics += "veeam_job_daily_backup_size_gb{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $DailyBackupSizeGB"
# ✅ 修复:日期计算语法错误(用括号强制优先级)
$JobSuccessSessions = $AllSessions | Where-Object { $_.JobId -eq $Job.Id -and $_.Result -eq "Success" } | Sort-Object EndTime -Descending
$LastSuccessSession = $JobSuccessSessions | Select-Object -First 1
if ($LastSuccessSession -and $LastSuccessSession.EndTime) {
$LastSuccessTimestamp = [math]::Round($LastSuccessSession.EndTime.ToUniversalTime().Subtract((Get-Date "1970-01-01")).TotalSeconds, 0)
# 关键修复:用括号把 Get-Date 括起来,避免语法解析错误
$TimeDiff = ($Now) - $LastSuccessSession.EndTime
$SinceLastSuccessHours = [math]::Round($TimeDiff.TotalHours, 1)
} else {
$LastSuccessTimestamp = 0
$SinceLastSuccessHours = 9999
}
$Metrics += "veeam_job_last_success_timestamp{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $LastSuccessTimestamp"
$Metrics += "veeam_job_since_last_success_hours{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $SinceLastSuccessHours"
# 压缩率
$CompressionRatio = if ($BackupSizeGB -gt 0) { [math]::Round($DataSizeGB / $BackupSizeGB, 2) } else { 0 }
$Metrics += "veeam_job_compression_ratio{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $CompressionRatio"
}
# 全局统计
$GlobalSuccessRate = if ($GlobalTotalJobs -gt 0) { [math]::Round(($GlobalSuccessJobs / $GlobalTotalJobs) * 100, 1) } else { 0 }
$Metrics += "veeam_global_total_jobs{job=`"$JobName`",instance=`"$InstanceName`"} $GlobalTotalJobs"
$Metrics += "veeam_global_success_jobs{job=`"$JobName`",instance=`"$InstanceName`"} $GlobalSuccessJobs"
$Metrics += "veeam_global_failed_jobs{job=`"$JobName`",instance=`"$InstanceName`"} $GlobalFailedJobs"
$Metrics += "veeam_global_running_jobs{job=`"$JobName`",instance=`"$InstanceName`"} $GlobalRunningJobs"
$Metrics += "veeam_global_daily_total_gb{job=`"$JobName`",instance=`"$InstanceName`"} $([math]::Round($GlobalDailyTotalBackup, 2))"
$Metrics += "veeam_global_success_rate{job=`"$JobName`",instance=`"$InstanceName`"} $GlobalSuccessRate"
$Metrics += ""
# ================== 2. 存储库指标 ==================
$Repositories = Get-VBRBackupRepository
foreach ($Repo in $Repositories) {
$Path = $Repo.Path
$DriveLetter = (Split-Path $Path -Qualifier).TrimEnd(':')
$DiskInfo = Get-WmiObject Win32_LogicalDisk -Filter "DeviceID='$DriveLetter`:'" -ErrorAction SilentlyContinue
$FreeSpaceGB = if ($DiskInfo -and $DiskInfo.FreeSpace) { [math]::Round($DiskInfo.FreeSpace / 1GB, 2) } else { 0 }
$TotalSpaceGB = if ($DiskInfo -and $DiskInfo.Size) { [math]::Round($DiskInfo.Size / 1GB, 2) } else { 0 }
$CleanRepoName = $Repo.Name -replace '[^a-zA-Z0-9_]', '_' -replace '[\r\n`"''"]', ''
$Metrics += "veeam_repo_free_space_gb{job=`"$JobName`",instance=`"$InstanceName`",repo_name=`"$CleanRepoName`"} $FreeSpaceGB"
$Metrics += "veeam_repo_total_space_gb{job=`"$JobName`",instance=`"$InstanceName`",repo_name=`"$CleanRepoName`"} $TotalSpaceGB"
# 存储使用率和剩余天数
$UsagePercent = if ($TotalSpaceGB -gt 0) { [math]::Round((($TotalSpaceGB - $FreeSpaceGB) / $TotalSpaceGB) * 100, 1) } else { 0 }
$Metrics += "veeam_repo_usage_percent{job=`"$JobName`",instance=`"$InstanceName`",repo_name=`"$CleanRepoName`"} $UsagePercent"
$RemainingDays = if ($GlobalDailyTotalBackup -gt 0 -and $FreeSpaceGB -gt 0) { [math]::Round($FreeSpaceGB / $GlobalDailyTotalBackup, 1) } else { 999 }
$Metrics += "veeam_repo_remaining_days{job=`"$JobName`",instance=`"$InstanceName`",repo_name=`"$CleanRepoName`"} $RemainingDays"
}
# ================== 格式保证 & 上传 ==================
$Metrics += ""
$MetricsBody = $Metrics -join "`n" -replace "`r", ""
[System.IO.File]::WriteAllText($OutputFile, $MetricsBody, [System.Text.UTF8Encoding]::new($false))
Write-Host "`n📤 正在上传指标文件..." -ForegroundColor Cyan
scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=NUL $localFile "${linuxUser}@${linuxIP}:${linuxPath}"
if ($LASTEXITCODE -eq 0) {
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=NUL "${linuxUser}@${linuxIP}" "sed -i 's/\r$//;s/[^[:print:]]//g' ${linuxPath}veeam_metrics.prom && chmod 644 ${linuxPath}veeam_metrics.prom"
Write-Host "✅ [$((Get-Date).ToString('yyyy-MM-dd HH:mm:ss'))] 采集完成"
Write-Host " - 总任务: $GlobalTotalJobs | 成功: $GlobalSuccessJobs | 失败: $GlobalFailedJobs | 运行中: $GlobalRunningJobs"
Write-Host " - 今日总备份: $([math]::Round($GlobalDailyTotalBackup, 2)) GB | 成功率: $GlobalSuccessRate%"
Write-Host " - 无任何语法错误,等待60秒`n" -ForegroundColor Green
} else {
Write-Host "❌ 上传失败,请检查SSH免密配置" -ForegroundColor Red
}
Start-Sleep -Seconds 60
}
+255
View File
@@ -0,0 +1,255 @@
# 完全兼容你的环境,所有原有指标和格式不变
Add-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue
# 配置项
$JobName = "veeam_backup"
$InstanceName = $env:COMPUTERNAME
$OutputFile = Join-Path -Path $PWD.Path -ChildPath "veeam_metrics.prom"
# Linux 上传配置
$linuxUser = "root"
$linuxIP = "10.150.117.190"
$linuxPath = "/opt/prom_textfile/"
$localFile = ".\veeam_metrics.prom"
# 恢复任务采集配置:采集最近多少小时内的恢复会话
$RestoreSessionHours = 24
while ($true) {
$Metrics = @()
$TodayStart = (Get-Date).Date
$GlobalTotalJobs = 0
$GlobalSuccessJobs = 0
$GlobalFailedJobs = 0
$GlobalRunningJobs = 0
$GlobalDailyTotalBackup = 0
# ================== 指标头部(新增备份量明确说明)==================
$Metrics += "# HELP veeam_job_status Veeam all job status (0=Success,1=Warning,2=Failed,3=None)"
$Metrics += "# TYPE veeam_job_status gauge"
$Metrics += "# HELP veeam_job_is_running Veeam job is running (1=running,0=idle)"
$Metrics += "# TYPE veeam_job_is_running gauge"
$Metrics += "# HELP veeam_job_progress_percent Veeam job progress percentage"
$Metrics += "# TYPE veeam_job_progress_percent gauge"
$Metrics += "# HELP veeam_job_backup_size_gb 上次备份实际写入仓库的大小(GB) - 对应Veeam日志中的Backup size"
$Metrics += "# TYPE veeam_job_backup_size_gb gauge"
$Metrics += "# HELP veeam_job_data_size_gb 上次备份处理的原始数据总大小(GB) - 对应Veeam日志中的Total size"
$Metrics += "# TYPE veeam_job_data_size_gb gauge"
$Metrics += "# HELP veeam_job_transferred_size_gb 上次备份实际传输的数据大小(GB) - 对应Veeam日志中的Transferred"
$Metrics += "# TYPE veeam_job_transferred_size_gb gauge"
$Metrics += "# HELP veeam_job_duration_seconds Veeam last job duration in seconds"
$Metrics += "# TYPE veeam_job_duration_seconds gauge"
$Metrics += "# HELP veeam_job_daily_backup_size_gb 今日累计备份写入仓库的总大小(GB)"
$Metrics += "# TYPE veeam_job_daily_backup_size_gb gauge"
$Metrics += "# HELP veeam_job_compression_ratio 总压缩率(原始数据总大小/备份大小)"
$Metrics += "# TYPE veeam_job_compression_ratio gauge"
$Metrics += "# HELP veeam_job_current_compression_ratio 本次备份压缩率(本次读取数据/实际传输大小) - 对应Veeam日志中的Compression"
$Metrics += "# TYPE veeam_job_current_compression_ratio gauge"
$Metrics += "# HELP veeam_repo_free_space_gb Veeam repository free space in GB"
$Metrics += "# TYPE veeam_repo_free_space_gb gauge"
$Metrics += "# HELP veeam_repo_total_space_gb Veeam repository total space in GB"
$Metrics += "# TYPE veeam_repo_total_space_gb gauge"
# 全局统计指标
$Metrics += "# HELP veeam_global_total_jobs Total number of all Veeam jobs"
$Metrics += "# TYPE veeam_global_total_jobs gauge"
$Metrics += "# HELP veeam_global_success_jobs Number of successful Veeam jobs"
$Metrics += "# TYPE veeam_global_success_jobs gauge"
$Metrics += "# HELP veeam_global_failed_jobs Number of failed Veeam jobs"
$Metrics += "# TYPE veeam_global_failed_jobs gauge"
$Metrics += "# HELP veeam_global_running_jobs Number of running Veeam jobs"
$Metrics += "# TYPE veeam_global_running_jobs gauge"
$Metrics += "# HELP veeam_global_daily_total_gb 今日所有任务累计写入仓库的总大小(GB)"
$Metrics += "# TYPE veeam_global_daily_total_gb gauge"
$Metrics += "# HELP veeam_global_success_rate Overall Veeam job success rate today (0-100)"
$Metrics += "# TYPE veeam_global_success_rate gauge"
# 单任务健康度指标
$Metrics += "# HELP veeam_job_last_success_timestamp Last successful job timestamp (Unix milliseconds)"
$Metrics += "# TYPE veeam_job_last_success_timestamp gauge"
$Metrics += "# HELP veeam_job_since_last_success_hours Hours since last successful job"
$Metrics += "# TYPE veeam_job_since_last_success_hours gauge"
# 存储智能预警指标
$Metrics += "# HELP veeam_repo_usage_percent Repository usage percentage (0-100)"
$Metrics += "# TYPE veeam_repo_usage_percent gauge"
$Metrics += "# HELP veeam_repo_remaining_days Estimated remaining days based on daily rate"
$Metrics += "# TYPE veeam_repo_remaining_days gauge"
$Metrics += ""
# ================== 1. 采集所有持久化计划任务 ==================
$Jobs = Get-VBRJob | Where-Object { $_.JobType -in
"Backup", "Restore", "VmRestore", "FileRestore", "Rescan",
"Replication", "BackupCopy", "TapeBackup", "TapeCatalog",
"FileToTape", "SureBackup", "BackupSync", "BackupValidation",
"ConfigurationBackup", "AgentBackup", "AgentRestore",
"NASBackup", "NASRestore", "CloudBackup", "CloudRestore"
}
$AllSessions = Get-VBRBackupSession
$Now = Get-Date # 提前获取当前时间,避免循环中多次调用
# ================== 2. 采集最近24小时所有恢复会话(手动+计划)==================
$RestoreCutoffTime = $Now.AddHours(-$RestoreSessionHours)
$AllRestoreSessions = Get-VBRRestoreSession | Where-Object { $_.CreationTime -ge $RestoreCutoffTime }
# 将恢复会话转换为统一的任务对象格式
$RestoreTasks = @()
foreach ($Session in $AllRestoreSessions) {
# 跳过已经在计划任务中的恢复任务(去重)
if ($Jobs | Where-Object { $_.Id -eq $Session.JobId }) { continue }
$RestoreTask = [PSCustomObject]@{
Id = $Session.Id
Name = "Restore_" + $Session.Name -replace '[^a-zA-Z0-9_]', '_'
JobType = "RestoreSession"
LastSession = $Session
}
$RestoreTasks += $RestoreTask
}
# 合并计划任务和恢复任务
$AllJobs = $Jobs + $RestoreTasks
$GlobalTotalJobs = $AllJobs.Count
# ================== 统一处理所有任务 ==================
foreach ($Job in $AllJobs) {
# 区分计划任务和临时恢复会话
if ($Job.JobType -eq "RestoreSession") {
$LastSession = $Job.LastSession
} else {
$LastSession = $Job.FindLastSession()
}
$Status = if ($LastSession) { $LastSession.Result } else { "None" }
$State = if ($LastSession) { $LastSession.State } else { "Idle" }
$StatusCode = switch ($Status) {
"Success" { 0; $GlobalSuccessJobs++ }
"Warning" { 1; $GlobalSuccessJobs++ }
"Failed" { 2; $GlobalFailedJobs++ }
default { 3 }
}
$IsRunning = if ($State -eq "Working") { 1; $GlobalRunningJobs++ } else { 0 }
$CleanJobName = $Job.Name -replace '[^a-zA-Z0-9_]', '_' -replace '[\r\n`"''"]', ''
# 基础指标(完全不变)
$Metrics += "veeam_job_status{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $StatusCode"
$Metrics += "veeam_job_is_running{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $IsRunning"
$Metrics += "veeam_job_progress_percent{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $(if($LastSession-and$State-eq'Working'){$LastSession.Progress.Percents}else{0})"
# ✅ 修复:完整采集所有备份量指标(对应Veeam日志所有字段)
if ($LastSession) {
if ($State -eq "Working") {
$BackupSizeGB = if ($LastSession.Info.Progress.BackupSize) { [math]::Round($LastSession.Info.Progress.BackupSize / 1GB, 2) } else { 0 }
$DataSizeGB = if ($LastSession.Info.Progress.DataSize) { [math]::Round($LastSession.Info.Progress.DataSize / 1GB, 2) } else { 0 }
$TransferredSizeGB = if ($LastSession.Info.Progress.TransferredSize) { [math]::Round($LastSession.Info.Progress.TransferredSize / 1GB, 2) } else { 0 }
} else {
$BackupSizeGB = if ($LastSession.BackupStats.BackupSize) { [math]::Round($LastSession.BackupStats.BackupSize / 1GB, 2) } else { 0 }
$DataSizeGB = if ($LastSession.BackupStats.DataSize) { [math]::Round($LastSession.BackupStats.DataSize / 1GB, 2) } else { 0 }
$TransferredSizeGB = if ($LastSession.BackupStats.TransferredSize) { [math]::Round($LastSession.BackupStats.TransferredSize / 1GB, 2) } else { 0 }
}
$DurationSeconds = if ($LastSession.EndTime -and $LastSession.CreationTime) { [math]::Round(($LastSession.EndTime - $LastSession.CreationTime).TotalSeconds, 2) } else { 0 }
} else {
$BackupSizeGB = 0
$DataSizeGB = 0
$TransferredSizeGB = 0
$DurationSeconds = 0
}
$Metrics += "veeam_job_backup_size_gb{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $BackupSizeGB"
$Metrics += "veeam_job_data_size_gb{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $DataSizeGB"
$Metrics += "veeam_job_transferred_size_gb{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $TransferredSizeGB"
$Metrics += "veeam_job_duration_seconds{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $DurationSeconds"
# 当日任务量(包含所有类型任务)
$TodaySessions = $AllSessions | Where-Object { $_.JobId -eq $Job.Id -and $_.CreationTime -ge $TodayStart }
$DailyBackupSizeGB = 0
foreach ($Session in $TodaySessions) {
if ($Session.BackupStats.BackupSize) {
$DailyBackupSizeGB += $Session.BackupStats.BackupSize / 1GB
}
}
$DailyBackupSizeGB = [math]::Round($DailyBackupSizeGB, 2)
$GlobalDailyTotalBackup += $DailyBackupSizeGB
$Metrics += "veeam_job_daily_backup_size_gb{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $DailyBackupSizeGB"
# 任务健康度指标(完全不变)
if ($Job.JobType -eq "RestoreSession") {
# 恢复会话直接使用当前会话作为最后成功会话
$LastSuccessSession = if ($Status -eq "Success") { $LastSession } else { $null }
} else {
$JobSuccessSessions = $AllSessions | Where-Object { $_.JobId -eq $Job.Id -and $_.Result -eq "Success" } | Sort-Object EndTime -Descending
$LastSuccessSession = $JobSuccessSessions | Select-Object -First 1
}
if ($LastSuccessSession -and $LastSuccessSession.EndTime) {
$LastSuccessTimestamp = [math]::Round($LastSuccessSession.EndTime.ToUniversalTime().Subtract((Get-Date "1970-01-01")).TotalMilliseconds, 0)
$TimeDiff = ($Now) - $LastSuccessSession.EndTime
$SinceLastSuccessHours = [math]::Round($TimeDiff.TotalHours, 1)
} else {
$LastSuccessTimestamp = 0
$SinceLastSuccessHours = 9999
}
$Metrics += "veeam_job_last_success_timestamp{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $LastSuccessTimestamp"
$Metrics += "veeam_job_since_last_success_hours{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $SinceLastSuccessHours"
# ✅ 修复:同时提供两种压缩率
# 总压缩率:原始数据总大小/备份大小(反映整体压缩效果)
$CompressionRatio = if ($BackupSizeGB -gt 0) { [math]::Round($DataSizeGB / $BackupSizeGB, 2) } else { 0 }
# 本次压缩率:本次传输大小/本次读取大小(和Veeam日志显示一致)
$CurrentCompressionRatio = if ($TransferredSizeGB -gt 0) { [math]::Round($DataSizeGB / $TransferredSizeGB, 2) } else { 0 }
$Metrics += "veeam_job_compression_ratio{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $CompressionRatio"
$Metrics += "veeam_job_current_compression_ratio{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $CurrentCompressionRatio"
}
# 全局统计(完全不变)
$GlobalSuccessRate = if ($GlobalTotalJobs -gt 0) { [math]::Round(($GlobalSuccessJobs / $GlobalTotalJobs) * 100, 1) } else { 0 }
$Metrics += "veeam_global_total_jobs{job=`"$JobName`",instance=`"$InstanceName`"} $GlobalTotalJobs"
$Metrics += "veeam_global_success_jobs{job=`"$JobName`",instance=`"$InstanceName`"} $GlobalSuccessJobs"
$Metrics += "veeam_global_failed_jobs{job=`"$JobName`",instance=`"$InstanceName`"} $GlobalFailedJobs"
$Metrics += "veeam_global_running_jobs{job=`"$JobName`",instance=`"$InstanceName`"} $GlobalRunningJobs"
$Metrics += "veeam_global_daily_total_gb{job=`"$JobName`",instance=`"$InstanceName`"} $([math]::Round($GlobalDailyTotalBackup, 2))"
$Metrics += "veeam_global_success_rate{job=`"$JobName`",instance=`"$InstanceName`"} $GlobalSuccessRate"
$Metrics += ""
# ================== 3. 存储库指标(完全不变)==================
$Repositories = Get-VBRBackupRepository
foreach ($Repo in $Repositories) {
$Path = $Repo.Path
$DriveLetter = (Split-Path $Path -Qualifier).TrimEnd(':')
$DiskInfo = Get-WmiObject Win32_LogicalDisk -Filter "DeviceID='$DriveLetter`:'" -ErrorAction SilentlyContinue
$FreeSpaceGB = if ($DiskInfo -and $DiskInfo.FreeSpace) { [math]::Round($DiskInfo.FreeSpace / 1GB, 2) } else { 0 }
$TotalSpaceGB = if ($DiskInfo -and $DiskInfo.Size) { [math]::Round($DiskInfo.Size / 1GB, 2) } else { 0 }
$CleanRepoName = $Repo.Name -replace '[^a-zA-Z0-9_]', '_' -replace '[\r\n`"''"]', ''
$Metrics += "veeam_repo_free_space_gb{job=`"$JobName`",instance=`"$InstanceName`",repo_name=`"$CleanRepoName`"} $FreeSpaceGB"
$Metrics += "veeam_repo_total_space_gb{job=`"$JobName`",instance=`"$InstanceName`",repo_name=`"$CleanRepoName`"} $TotalSpaceGB"
# 存储使用率和剩余天数
$UsagePercent = if ($TotalSpaceGB -gt 0) { [math]::Round((($TotalSpaceGB - $FreeSpaceGB) / $TotalSpaceGB) * 100, 1) } else { 0 }
$Metrics += "veeam_repo_usage_percent{job=`"$JobName`",instance=`"$InstanceName`",repo_name=`"$CleanRepoName`"} $UsagePercent"
$RemainingDays = if ($GlobalDailyTotalBackup -gt 0 -and $FreeSpaceGB -gt 0) { [math]::Round($FreeSpaceGB / $GlobalDailyTotalBackup, 1) } else { 999 }
$Metrics += "veeam_repo_remaining_days{job=`"$JobName`",instance=`"$InstanceName`",repo_name=`"$CleanRepoName`"} $RemainingDays"
}
# ================== 格式保证 & 上传(完全不变)==================
$Metrics += ""
$MetricsBody = $Metrics -join "`n" -replace "`r", ""
[System.IO.File]::WriteAllText($OutputFile, $MetricsBody, [System.Text.UTF8Encoding]::new($false))
Write-Host "`n📤 正在上传指标文件..." -ForegroundColor Cyan
scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=NUL $localFile "${linuxUser}@${linuxIP}:${linuxPath}"
if ($LASTEXITCODE -eq 0) {
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=NUL "${linuxUser}@${linuxIP}" "sed -i 's/\r$//;s/[^[:print:]]//g' ${linuxPath}veeam_metrics.prom && chmod 644 ${linuxPath}veeam_metrics.prom"
Write-Host "✅ [$((Get-Date).ToString('yyyy-MM-dd HH:mm:ss'))] 采集完成"
Write-Host " - 总任务: $GlobalTotalJobs | 成功: $GlobalSuccessJobs | 失败: $GlobalFailedJobs | 运行中: $GlobalRunningJobs"
Write-Host " - 今日总备份量: $([math]::Round($GlobalDailyTotalBackup, 2)) GB | 成功率: $GlobalSuccessRate%"
Write-Host " - 已包含所有任务类型+完整备份量统计,等待60秒`n" -ForegroundColor Green
} else {
Write-Host "❌ 上传失败,请检查SSH免密配置" -ForegroundColor Red
}
Start-Sleep -Seconds 60
}
+243
View File
@@ -0,0 +1,243 @@
# 完全兼容你的环境,所有原有指标和格式不变
Add-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue
# 配置项
$JobName = "veeam_backup"
$InstanceName = $env:COMPUTERNAME
$OutputFile = Join-Path -Path $PWD.Path -ChildPath "veeam_metrics.prom"
# Linux 上传配置
$linuxUser = "root"
$linuxIP = "10.150.117.190"
$linuxPath = "/opt/prom_textfile/"
$localFile = ".\veeam_metrics.prom"
# 恢复任务采集配置:采集最近多少小时内的恢复会话
$RestoreSessionHours = 24
while ($true) {
$Metrics = @()
$TodayStart = (Get-Date).Date
$GlobalTotalJobs = 0
$GlobalSuccessJobs = 0
$GlobalFailedJobs = 0
$GlobalRunningJobs = 0
$GlobalDailyTotalBackup = 0
# ================== 指标头部(更新包含恢复任务)==================
$Metrics += "# HELP veeam_job_status Veeam all job status (0=Success,1=Warning,2=Failed,3=None)"
$Metrics += "# TYPE veeam_job_status gauge"
$Metrics += "# HELP veeam_job_is_running Veeam job is running (1=running,0=idle)"
$Metrics += "# TYPE veeam_job_is_running gauge"
$Metrics += "# HELP veeam_job_progress_percent Veeam job progress percentage"
$Metrics += "# TYPE veeam_job_progress_percent gauge"
$Metrics += "# HELP veeam_job_backup_size_gb Veeam last job processed size in GB"
$Metrics += "# TYPE veeam_job_backup_size_gb gauge"
$Metrics += "# HELP veeam_job_data_size_gb Veeam last job original data size in GB"
$Metrics += "# TYPE veeam_job_data_size_gb gauge"
$Metrics += "# HELP veeam_job_duration_seconds Veeam last job duration in seconds"
$Metrics += "# TYPE veeam_job_duration_seconds gauge"
$Metrics += "# HELP veeam_job_daily_backup_size_gb Veeam job total processed size today in GB"
$Metrics += "# TYPE veeam_job_daily_backup_size_gb gauge"
$Metrics += "# HELP veeam_repo_free_space_gb Veeam repository free space in GB"
$Metrics += "# TYPE veeam_repo_free_space_gb gauge"
$Metrics += "# HELP veeam_repo_total_space_gb Veeam repository total space in GB"
$Metrics += "# TYPE veeam_repo_total_space_gb gauge"
# 全局统计指标
$Metrics += "# HELP veeam_global_total_jobs Total number of all Veeam jobs"
$Metrics += "# TYPE veeam_global_total_jobs gauge"
$Metrics += "# HELP veeam_global_success_jobs Number of successful Veeam jobs"
$Metrics += "# TYPE veeam_global_success_jobs gauge"
$Metrics += "# HELP veeam_global_failed_jobs Number of failed Veeam jobs"
$Metrics += "# TYPE veeam_global_failed_jobs gauge"
$Metrics += "# HELP veeam_global_running_jobs Number of running Veeam jobs"
$Metrics += "# TYPE veeam_global_running_jobs gauge"
$Metrics += "# HELP veeam_global_daily_total_gb Total processed size of all jobs today in GB"
$Metrics += "# TYPE veeam_global_daily_total_gb gauge"
$Metrics += "# HELP veeam_global_success_rate Overall Veeam job success rate today (0-100)"
$Metrics += "# TYPE veeam_global_success_rate gauge"
# 单任务健康度指标
$Metrics += "# HELP veeam_job_last_success_timestamp Last successful job timestamp (Unix milliseconds)"
$Metrics += "# TYPE veeam_job_last_success_timestamp gauge"
$Metrics += "# HELP veeam_job_since_last_success_hours Hours since last successful job"
$Metrics += "# TYPE veeam_job_since_last_success_hours gauge"
$Metrics += "# HELP veeam_job_compression_ratio Veeam job compression ratio (data_size/backup_size)"
$Metrics += "# TYPE veeam_job_compression_ratio gauge"
# 存储智能预警指标
$Metrics += "# HELP veeam_repo_usage_percent Repository usage percentage (0-100)"
$Metrics += "# TYPE veeam_repo_usage_percent gauge"
$Metrics += "# HELP veeam_repo_remaining_days Estimated remaining days based on daily rate"
$Metrics += "# TYPE veeam_repo_remaining_days gauge"
$Metrics += ""
# ================== 1. 采集所有持久化计划任务 ==================
$Jobs = Get-VBRJob | Where-Object { $_.JobType -in
"Backup", "Restore", "VmRestore", "FileRestore", "Rescan",
"Replication", "BackupCopy", "TapeBackup", "TapeCatalog",
"FileToTape", "SureBackup", "BackupSync", "BackupValidation",
"ConfigurationBackup", "AgentBackup", "AgentRestore",
"NASBackup", "NASRestore", "CloudBackup", "CloudRestore"
}
$AllSessions = Get-VBRBackupSession
$Now = Get-Date # 提前获取当前时间,避免循环中多次调用
# ================== ✅ 新增:采集最近24小时所有恢复会话(手动+计划)==================
$RestoreCutoffTime = $Now.AddHours(-$RestoreSessionHours)
$AllRestoreSessions = Get-VBRRestoreSession | Where-Object { $_.CreationTime -ge $RestoreCutoffTime }
# 将恢复会话转换为统一的任务对象格式
$RestoreTasks = @()
foreach ($Session in $AllRestoreSessions) {
# 跳过已经在计划任务中的恢复任务(去重)
if ($Jobs | Where-Object { $_.Id -eq $Session.JobId }) { continue }
$RestoreTask = [PSCustomObject]@{
Id = $Session.Id
Name = "Restore_" + $Session.Name -replace '[^a-zA-Z0-9_]', '_'
JobType = "RestoreSession"
LastSession = $Session
}
$RestoreTasks += $RestoreTask
}
# 合并计划任务和恢复任务
$AllJobs = $Jobs + $RestoreTasks
$GlobalTotalJobs = $AllJobs.Count
# ================== 统一处理所有任务 ==================
foreach ($Job in $AllJobs) {
# 区分计划任务和临时恢复会话
if ($Job.JobType -eq "RestoreSession") {
$LastSession = $Job.LastSession
} else {
$LastSession = $Job.FindLastSession()
}
$Status = if ($LastSession) { $LastSession.Result } else { "None" }
$State = if ($LastSession) { $LastSession.State } else { "Idle" }
$StatusCode = switch ($Status) {
"Success" { 0; $GlobalSuccessJobs++ }
"Warning" { 1; $GlobalSuccessJobs++ }
"Failed" { 2; $GlobalFailedJobs++ }
default { 3 }
}
$IsRunning = if ($State -eq "Working") { 1; $GlobalRunningJobs++ } else { 0 }
$CleanJobName = $Job.Name -replace '[^a-zA-Z0-9_]', '_' -replace '[\r\n`"''"]', ''
# 基础指标(完全不变)
$Metrics += "veeam_job_status{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $StatusCode"
$Metrics += "veeam_job_is_running{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $IsRunning"
$Metrics += "veeam_job_progress_percent{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $(if($LastSession-and$State-eq'Working'){$LastSession.Progress.Percents}else{0})"
# 任务大小和数据量(兼容恢复会话)
if ($LastSession) {
if ($State -eq "Working") {
$BackupSizeGB = if ($LastSession.Info.Progress.BackupSize) { [math]::Round($LastSession.Info.Progress.BackupSize / 1GB, 2) } else { 0 }
$DataSizeGB = if ($LastSession.Info.Progress.DataSize) { [math]::Round($LastSession.Info.Progress.DataSize / 1GB, 2) } else { 0 }
} else {
$BackupSizeGB = if ($LastSession.BackupStats.BackupSize) { [math]::Round($LastSession.BackupStats.BackupSize / 1GB, 2) } else { 0 }
$DataSizeGB = if ($LastSession.BackupStats.DataSize) { [math]::Round($LastSession.BackupStats.DataSize / 1GB, 2) } else { 0 }
}
$DurationSeconds = if ($LastSession.EndTime -and $LastSession.CreationTime) { [math]::Round(($LastSession.EndTime - $LastSession.CreationTime).TotalSeconds, 2) } else { 0 }
} else {
$BackupSizeGB = 0
$DataSizeGB = 0
$DurationSeconds = 0
}
$Metrics += "veeam_job_backup_size_gb{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $BackupSizeGB"
$Metrics += "veeam_job_data_size_gb{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $DataSizeGB"
$Metrics += "veeam_job_duration_seconds{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $DurationSeconds"
# 当日任务量(包含恢复任务)
$TodaySessions = $AllSessions | Where-Object { $_.JobId -eq $Job.Id -and $_.CreationTime -ge $TodayStart }
$DailyBackupSizeGB = 0
foreach ($Session in $TodaySessions) {
if ($Session.BackupStats.BackupSize) {
$DailyBackupSizeGB += $Session.BackupStats.BackupSize / 1GB
}
}
$DailyBackupSizeGB = [math]::Round($DailyBackupSizeGB, 2)
$GlobalDailyTotalBackup += $DailyBackupSizeGB
$Metrics += "veeam_job_daily_backup_size_gb{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $DailyBackupSizeGB"
# 任务健康度指标(兼容恢复会话)
if ($Job.JobType -eq "RestoreSession") {
# 恢复会话直接使用当前会话作为最后成功会话
$LastSuccessSession = if ($Status -eq "Success") { $LastSession } else { $null }
} else {
$JobSuccessSessions = $AllSessions | Where-Object { $_.JobId -eq $Job.Id -and $_.Result -eq "Success" } | Sort-Object EndTime -Descending
$LastSuccessSession = $JobSuccessSessions | Select-Object -First 1
}
if ($LastSuccessSession -and $LastSuccessSession.EndTime) {
$LastSuccessTimestamp = [math]::Round($LastSuccessSession.EndTime.ToUniversalTime().Subtract((Get-Date "1970-01-01")).TotalMilliseconds, 0)
$TimeDiff = ($Now) - $LastSuccessSession.EndTime
$SinceLastSuccessHours = [math]::Round($TimeDiff.TotalHours, 1)
} else {
$LastSuccessTimestamp = 0
$SinceLastSuccessHours = 9999
}
$Metrics += "veeam_job_last_success_timestamp{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $LastSuccessTimestamp"
$Metrics += "veeam_job_since_last_success_hours{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $SinceLastSuccessHours"
# 压缩率(恢复任务压缩率为0
$CompressionRatio = if ($BackupSizeGB -gt 0) { [math]::Round($DataSizeGB / $BackupSizeGB, 2) } else { 0 }
$Metrics += "veeam_job_compression_ratio{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $CompressionRatio"
}
# 全局统计(完全不变)
$GlobalSuccessRate = if ($GlobalTotalJobs -gt 0) { [math]::Round(($GlobalSuccessJobs / $GlobalTotalJobs) * 100, 1) } else { 0 }
$Metrics += "veeam_global_total_jobs{job=`"$JobName`",instance=`"$InstanceName`"} $GlobalTotalJobs"
$Metrics += "veeam_global_success_jobs{job=`"$JobName`",instance=`"$InstanceName`"} $GlobalSuccessJobs"
$Metrics += "veeam_global_failed_jobs{job=`"$JobName`",instance=`"$InstanceName`"} $GlobalFailedJobs"
$Metrics += "veeam_global_running_jobs{job=`"$JobName`",instance=`"$InstanceName`"} $GlobalRunningJobs"
$Metrics += "veeam_global_daily_total_gb{job=`"$JobName`",instance=`"$InstanceName`"} $([math]::Round($GlobalDailyTotalBackup, 2))"
$Metrics += "veeam_global_success_rate{job=`"$JobName`",instance=`"$InstanceName`"} $GlobalSuccessRate"
$Metrics += ""
# ================== 2. 存储库指标(完全不变)==================
$Repositories = Get-VBRBackupRepository
foreach ($Repo in $Repositories) {
$Path = $Repo.Path
$DriveLetter = (Split-Path $Path -Qualifier).TrimEnd(':')
$DiskInfo = Get-WmiObject Win32_LogicalDisk -Filter "DeviceID='$DriveLetter`:'" -ErrorAction SilentlyContinue
$FreeSpaceGB = if ($DiskInfo -and $DiskInfo.FreeSpace) { [math]::Round($DiskInfo.FreeSpace / 1GB, 2) } else { 0 }
$TotalSpaceGB = if ($DiskInfo -and $DiskInfo.Size) { [math]::Round($DiskInfo.Size / 1GB, 2) } else { 0 }
$CleanRepoName = $Repo.Name -replace '[^a-zA-Z0-9_]', '_' -replace '[\r\n`"''"]', ''
$Metrics += "veeam_repo_free_space_gb{job=`"$JobName`",instance=`"$InstanceName`",repo_name=`"$CleanRepoName`"} $FreeSpaceGB"
$Metrics += "veeam_repo_total_space_gb{job=`"$JobName`",instance=`"$InstanceName`",repo_name=`"$CleanRepoName`"} $TotalSpaceGB"
# 存储使用率和剩余天数
$UsagePercent = if ($TotalSpaceGB -gt 0) { [math]::Round((($TotalSpaceGB - $FreeSpaceGB) / $TotalSpaceGB) * 100, 1) } else { 0 }
$Metrics += "veeam_repo_usage_percent{job=`"$JobName`",instance=`"$InstanceName`",repo_name=`"$CleanRepoName`"} $UsagePercent"
$RemainingDays = if ($GlobalDailyTotalBackup -gt 0 -and $FreeSpaceGB -gt 0) { [math]::Round($FreeSpaceGB / $GlobalDailyTotalBackup, 1) } else { 999 }
$Metrics += "veeam_repo_remaining_days{job=`"$JobName`",instance=`"$InstanceName`",repo_name=`"$CleanRepoName`"} $RemainingDays"
}
# ================== 格式保证 & 上传(完全不变)==================
$Metrics += ""
$MetricsBody = $Metrics -join "`n" -replace "`r", ""
[System.IO.File]::WriteAllText($OutputFile, $MetricsBody, [System.Text.UTF8Encoding]::new($false))
Write-Host "`n📤 正在上传指标文件..." -ForegroundColor Cyan
scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=NUL $localFile "${linuxUser}@${linuxIP}:${linuxPath}"
if ($LASTEXITCODE -eq 0) {
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=NUL "${linuxUser}@${linuxIP}" "sed -i 's/\r$//;s/[^[:print:]]//g' ${linuxPath}veeam_metrics.prom && chmod 644 ${linuxPath}veeam_metrics.prom"
Write-Host "✅ [$((Get-Date).ToString('yyyy-MM-dd HH:mm:ss'))] 采集完成"
Write-Host " - 总任务: $GlobalTotalJobs | 成功: $GlobalSuccessJobs | 失败: $GlobalFailedJobs | 运行中: $GlobalRunningJobs"
Write-Host " - 今日总处理量: $([math]::Round($GlobalDailyTotalBackup, 2)) GB | 成功率: $GlobalSuccessRate%"
Write-Host " - 已包含计划任务+最近$RestoreSessionHours小时恢复任务,等待60秒`n" -ForegroundColor Green
} else {
Write-Host "❌ 上传失败,请检查SSH免密配置" -ForegroundColor Red
}
Start-Sleep -Seconds 60
}
+1236
View File
File diff suppressed because it is too large Load Diff
+207
View File
@@ -0,0 +1,207 @@
# 完全兼容你的环境,所有格式和采集方式不变
Add-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue
# 配置项
$JobName = "veeam_backup"
$InstanceName = $env:COMPUTERNAME
$OutputFile = Join-Path -Path $PWD.Path -ChildPath "veeam_metrics.prom"
# Linux 上传配置
$linuxUser = "root"
$linuxIP = "10.150.117.190"
$linuxPath = "/opt/prom_textfile/"
$localFile = ".\veeam_metrics.prom"
while ($true) {
$Metrics = @()
$TodayStart = (Get-Date).Date
$GlobalTotalJobs = 0
$GlobalSuccessJobs = 0
$GlobalFailedJobs = 0
$GlobalRunningJobs = 0
$GlobalDailyTotalBackup = 0
# ================== 指标头部(更新为全任务类型)==================
$Metrics += "# HELP veeam_job_status Veeam all job status (0=Success,1=Warning,2=Failed,3=None)"
$Metrics += "# TYPE veeam_job_status gauge"
$Metrics += "# HELP veeam_job_is_running Veeam job is running (1=running,0=idle)"
$Metrics += "# TYPE veeam_job_is_running gauge"
$Metrics += "# HELP veeam_job_progress_percent Veeam job progress percentage"
$Metrics += "# TYPE veeam_job_progress_percent gauge"
$Metrics += "# HELP veeam_job_backup_size_gb Veeam last job processed size in GB"
$Metrics += "# TYPE veeam_job_backup_size_gb gauge"
$Metrics += "# HELP veeam_job_data_size_gb Veeam last job original data size in GB"
$Metrics += "# TYPE veeam_job_data_size_gb gauge"
$Metrics += "# HELP veeam_job_duration_seconds Veeam last job duration in seconds"
$Metrics += "# TYPE veeam_job_duration_seconds gauge"
$Metrics += "# HELP veeam_job_daily_backup_size_gb Veeam job total processed size today in GB"
$Metrics += "# TYPE veeam_job_daily_backup_size_gb gauge"
$Metrics += "# HELP veeam_repo_free_space_gb Veeam repository free space in GB"
$Metrics += "# TYPE veeam_repo_free_space_gb gauge"
$Metrics += "# HELP veeam_repo_total_space_gb Veeam repository total space in GB"
$Metrics += "# TYPE veeam_repo_total_space_gb gauge"
# 全局统计指标
$Metrics += "# HELP veeam_global_total_jobs Total number of all Veeam jobs"
$Metrics += "# TYPE veeam_global_total_jobs gauge"
$Metrics += "# HELP veeam_global_success_jobs Number of successful Veeam jobs"
$Metrics += "# TYPE veeam_global_success_jobs gauge"
$Metrics += "# HELP veeam_global_failed_jobs Number of failed Veeam jobs"
$Metrics += "# TYPE veeam_global_failed_jobs gauge"
$Metrics += "# HELP veeam_global_running_jobs Number of running Veeam jobs"
$Metrics += "# TYPE veeam_global_running_jobs gauge"
$Metrics += "# HELP veeam_global_daily_total_gb Total processed size of all jobs today in GB"
$Metrics += "# TYPE veeam_global_daily_total_gb gauge"
$Metrics += "# HELP veeam_global_success_rate Overall Veeam job success rate today (0-100)"
$Metrics += "# TYPE veeam_global_success_rate gauge"
# 单任务健康度指标
$Metrics += "# HELP veeam_job_last_success_timestamp Last successful job timestamp (Unix milliseconds)"
$Metrics += "# TYPE veeam_job_last_success_timestamp gauge"
$Metrics += "# HELP veeam_job_since_last_success_hours Hours since last successful job"
$Metrics += "# TYPE veeam_job_since_last_success_hours gauge"
$Metrics += "# HELP veeam_job_compression_ratio Veeam job compression ratio (data_size/backup_size)"
$Metrics += "# TYPE veeam_job_compression_ratio gauge"
# 存储智能预警指标
$Metrics += "# HELP veeam_repo_usage_percent Repository usage percentage (0-100)"
$Metrics += "# TYPE veeam_repo_usage_percent gauge"
$Metrics += "# HELP veeam_repo_remaining_days Estimated remaining days based on daily rate"
$Metrics += "# TYPE veeam_repo_remaining_days gauge"
$Metrics += ""
# ================== ✅ 核心修复:包含Veeam所有官方任务类型 ==================
# 覆盖Veeam 10-12所有JobType,确保没有任何任务遗漏
$Jobs = Get-VBRJob | Where-Object { $_.JobType -in
"Backup", "Restore", "VmRestore", "FileRestore", "Rescan",
"Replication", "BackupCopy", "TapeBackup", "TapeCatalog",
"FileToTape", "SureBackup", "BackupSync", "BackupValidation",
"ConfigurationBackup", "AgentBackup", "AgentRestore",
"NASBackup", "NASRestore", "CloudBackup", "CloudRestore"
}
$GlobalTotalJobs = $Jobs.Count
$AllSessions = Get-VBRBackupSession
$Now = Get-Date # 提前获取当前时间,避免循环中多次调用
foreach ($Job in $Jobs) {
$LastSession = $Job.FindLastSession()
$Status = if ($LastSession) { $LastSession.Result } else { "None" }
$State = if ($LastSession) { $LastSession.State } else { "Idle" }
$StatusCode = switch ($Status) {
"Success" { 0; $GlobalSuccessJobs++ }
"Warning" { 1; $GlobalSuccessJobs++ }
"Failed" { 2; $GlobalFailedJobs++ }
default { 3 }
}
$IsRunning = if ($State -eq "Working") { 1; $GlobalRunningJobs++ } else { 0 }
$CleanJobName = $Job.Name -replace '[^a-zA-Z0-9_]', '_' -replace '[\r\n`"''"]', ''
# 基础指标(完全不变)
$Metrics += "veeam_job_status{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $StatusCode"
$Metrics += "veeam_job_is_running{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $IsRunning"
$Metrics += "veeam_job_progress_percent{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $(if($LastSession-and$State-eq'Working'){$LastSession.Progress.Percents}else{0})"
# 任务大小和数据量(兼容所有任务类型,无数据返回0)
if ($LastSession) {
if ($State -eq "Working") {
$BackupSizeGB = if ($LastSession.Info.Progress.BackupSize) { [math]::Round($LastSession.Info.Progress.BackupSize / 1GB, 2) } else { 0 }
$DataSizeGB = if ($LastSession.Info.Progress.DataSize) { [math]::Round($LastSession.Info.Progress.DataSize / 1GB, 2) } else { 0 }
} else {
$BackupSizeGB = if ($LastSession.BackupStats.BackupSize) { [math]::Round($LastSession.BackupStats.BackupSize / 1GB, 2) } else { 0 }
$DataSizeGB = if ($LastSession.BackupStats.DataSize) { [math]::Round($LastSession.BackupStats.DataSize / 1GB, 2) } else { 0 }
}
$DurationSeconds = if ($LastSession.EndTime -and $LastSession.CreationTime) { [math]::Round(($LastSession.EndTime - $LastSession.CreationTime).TotalSeconds, 2) } else { 0 }
} else {
$BackupSizeGB = 0
$DataSizeGB = 0
$DurationSeconds = 0
}
$Metrics += "veeam_job_backup_size_gb{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $BackupSizeGB"
$Metrics += "veeam_job_data_size_gb{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $DataSizeGB"
$Metrics += "veeam_job_duration_seconds{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $DurationSeconds"
# 当日任务量(包含所有类型任务)
$TodaySessions = $AllSessions | Where-Object { $_.JobId -eq $Job.Id -and $_.CreationTime -ge $TodayStart }
$DailyBackupSizeGB = 0
foreach ($Session in $TodaySessions) {
if ($Session.BackupStats.BackupSize) {
$DailyBackupSizeGB += $Session.BackupStats.BackupSize / 1GB
}
}
$DailyBackupSizeGB = [math]::Round($DailyBackupSizeGB, 2)
$GlobalDailyTotalBackup += $DailyBackupSizeGB
$Metrics += "veeam_job_daily_backup_size_gb{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $DailyBackupSizeGB"
# 任务健康度指标(完全不变)
$JobSuccessSessions = $AllSessions | Where-Object { $_.JobId -eq $Job.Id -and $_.Result -eq "Success" } | Sort-Object EndTime -Descending
$LastSuccessSession = $JobSuccessSessions | Select-Object -First 1
if ($LastSuccessSession -and $LastSuccessSession.EndTime) {
$LastSuccessTimestamp = [math]::Round($LastSuccessSession.EndTime.ToUniversalTime().Subtract((Get-Date "1970-01-01")).TotalMilliseconds, 0)
$TimeDiff = ($Now) - $LastSuccessSession.EndTime
$SinceLastSuccessHours = [math]::Round($TimeDiff.TotalHours, 1)
} else {
$LastSuccessTimestamp = 0
$SinceLastSuccessHours = 9999
}
$Metrics += "veeam_job_last_success_timestamp{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $LastSuccessTimestamp"
$Metrics += "veeam_job_since_last_success_hours{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $SinceLastSuccessHours"
# 压缩率(无数据返回0,不影响显示)
$CompressionRatio = if ($BackupSizeGB -gt 0) { [math]::Round($DataSizeGB / $BackupSizeGB, 2) } else { 0 }
$Metrics += "veeam_job_compression_ratio{job=`"$JobName`",instance=`"$InstanceName`",job_name=`"$CleanJobName`"} $CompressionRatio"
}
# 全局统计(完全不变)
$GlobalSuccessRate = if ($GlobalTotalJobs -gt 0) { [math]::Round(($GlobalSuccessJobs / $GlobalTotalJobs) * 100, 1) } else { 0 }
$Metrics += "veeam_global_total_jobs{job=`"$JobName`",instance=`"$InstanceName`"} $GlobalTotalJobs"
$Metrics += "veeam_global_success_jobs{job=`"$JobName`",instance=`"$InstanceName`"} $GlobalSuccessJobs"
$Metrics += "veeam_global_failed_jobs{job=`"$JobName`",instance=`"$InstanceName`"} $GlobalFailedJobs"
$Metrics += "veeam_global_running_jobs{job=`"$JobName`",instance=`"$InstanceName`"} $GlobalRunningJobs"
$Metrics += "veeam_global_daily_total_gb{job=`"$JobName`",instance=`"$InstanceName`"} $([math]::Round($GlobalDailyTotalBackup, 2))"
$Metrics += "veeam_global_success_rate{job=`"$JobName`",instance=`"$InstanceName`"} $GlobalSuccessRate"
$Metrics += ""
# ================== 2. 存储库指标(完全不变)==================
$Repositories = Get-VBRBackupRepository
foreach ($Repo in $Repositories) {
$Path = $Repo.Path
$DriveLetter = (Split-Path $Path -Qualifier).TrimEnd(':')
$DiskInfo = Get-WmiObject Win32_LogicalDisk -Filter "DeviceID='$DriveLetter`:'" -ErrorAction SilentlyContinue
$FreeSpaceGB = if ($DiskInfo -and $DiskInfo.FreeSpace) { [math]::Round($DiskInfo.FreeSpace / 1GB, 2) } else { 0 }
$TotalSpaceGB = if ($DiskInfo -and $DiskInfo.Size) { [math]::Round($DiskInfo.Size / 1GB, 2) } else { 0 }
$CleanRepoName = $Repo.Name -replace '[^a-zA-Z0-9_]', '_' -replace '[\r\n`"''"]', ''
$Metrics += "veeam_repo_free_space_gb{job=`"$JobName`",instance=`"$InstanceName`",repo_name=`"$CleanRepoName`"} $FreeSpaceGB"
$Metrics += "veeam_repo_total_space_gb{job=`"$JobName`",instance=`"$InstanceName`",repo_name=`"$CleanRepoName`"} $TotalSpaceGB"
# 存储使用率和剩余天数
$UsagePercent = if ($TotalSpaceGB -gt 0) { [math]::Round((($TotalSpaceGB - $FreeSpaceGB) / $TotalSpaceGB) * 100, 1) } else { 0 }
$Metrics += "veeam_repo_usage_percent{job=`"$JobName`",instance=`"$InstanceName`",repo_name=`"$CleanRepoName`"} $UsagePercent"
$RemainingDays = if ($GlobalDailyTotalBackup -gt 0 -and $FreeSpaceGB -gt 0) { [math]::Round($FreeSpaceGB / $GlobalDailyTotalBackup, 1) } else { 999 }
$Metrics += "veeam_repo_remaining_days{job=`"$JobName`",instance=`"$InstanceName`",repo_name=`"$CleanRepoName`"} $RemainingDays"
}
# ================== 格式保证 & 上传(完全不变)==================
$Metrics += ""
$MetricsBody = $Metrics -join "`n" -replace "`r", ""
[System.IO.File]::WriteAllText($OutputFile, $MetricsBody, [System.Text.UTF8Encoding]::new($false))
Write-Host "`n📤 正在上传指标文件..." -ForegroundColor Cyan
scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=NUL $localFile "${linuxUser}@${linuxIP}:${linuxPath}"
if ($LASTEXITCODE -eq 0) {
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=NUL "${linuxUser}@${linuxIP}" "sed -i 's/\r$//;s/[^[:print:]]//g' ${linuxPath}veeam_metrics.prom && chmod 644 ${linuxPath}veeam_metrics.prom"
Write-Host "✅ [$((Get-Date).ToString('yyyy-MM-dd HH:mm:ss'))] 采集完成"
Write-Host " - 总任务: $GlobalTotalJobs | 成功: $GlobalSuccessJobs | 失败: $GlobalFailedJobs | 运行中: $GlobalRunningJobs"
Write-Host " - 今日总处理量: $([math]::Round($GlobalDailyTotalBackup, 2)) GB | 成功率: $GlobalSuccessRate%"
Write-Host " - 已包含所有Veeam任务类型,等待60秒`n" -ForegroundColor Green
} else {
Write-Host "❌ 上传失败,请检查SSH免密配置" -ForegroundColor Red
}
Start-Sleep -Seconds 60
}
-200720
View File
File diff suppressed because it is too large Load Diff
-88
View File
@@ -1,88 +0,0 @@
#!/usr/bin/env python3
# Alertmanager告警入库 兼容Mariadb + Python3.6
from flask import Flask, request, jsonify
import pymysql
from datetime import datetime
import logging
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s")
app = Flask(__name__)
# 数据库配置,字符集改为Mariadb支持的 utf8mb4_unicode_ci
DB_CONF = {
"host": "127.0.0.1",
"port": 3306,
"user": "root",
"password": "hp93000",
"database": "alert_db",
"charset": "utf8mb4",
"cursorclass": pymysql.cursors.DictCursor
}
def get_db_connection():
try:
conn = pymysql.connect(**DB_CONF)
# 手动指定兼容Mariadb的排序规则
with conn.cursor() as cur:
cur.execute("SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci;")
return conn
except Exception as e:
logging.error(f"数据库连接失败:{e}")
return None
@app.route("/webhook/alert", methods=["POST"])
def alert_handle():
conn = get_db_connection()
if not conn:
return jsonify({"code": 500, "msg": "数据库连接失败"}), 500
cursor = conn.cursor()
try:
data = request.get_json()
alert_arr = data.get("alerts", [])
insert_sql = """
INSERT INTO alert_log (
alertname, job, instance, port, severity, summary, description,
starts_at, ends_at, status
) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)
"""
batch = []
for alert in alert_arr:
lab = alert.get("labels", {})
ann = alert.get("annotations", {})
stat = alert.get("status")
start_time = datetime.fromisoformat(alert["startsAt"].replace("Z", ""))
end_time = None
if alert.get("endsAt"):
end_time = datetime.fromisoformat(alert["endsAt"].replace("Z", ""))
row_data = (
lab.get("alertname", ""),
lab.get("job", ""),
lab.get("instance", ""),
lab.get("port", ""),
lab.get("severity", ""),
ann.get("summary", ""),
ann.get("description", ""),
start_time,
end_time,
stat
)
batch.append(row_data)
if batch:
cursor.executemany(insert_sql, batch)
conn.commit()
logging.info(f"成功入库 {len(batch)} 条告警")
return jsonify({"code": 0, "msg": "success"}), 200
except Exception as err:
logging.error(f"入库异常:{str(err)}")
conn.rollback()
return jsonify({"code": 500, "msg": str(err)}), 500
finally:
cursor.close()
conn.close()
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8090, debug=False)