vim prometheus/config.yaml #添加
- job_name: 'yty-process' #进程监控
static_configs:
- targets: ['xxx.xxx.xxx.xxx:9256']
vim prometheus/rules.yaml #添加
- name: process
rules:
- alert: ProcessAbutDown
expr: (namedprocess_namegroup_num_procs{groupname="map[:sys#abut-exec.jar]"}) == 0
for: 1m
labels:
severity: warning
annotations:
summary: "{{ $labels.instance }}: Process Abut-exec Down"
description: "{{ $labels.instance }}: Process Abut-exec has been down for more than 1m"
value: "{{ $value }}"
- alert: ProcessOpenDown
expr: (namedprocess_namegroup_num_procs{groupname="map[:sys#open-exec.jar]"}) == 0
for: 1m
labels:
severity: warning
annotations:
summary: "{{ $labels.instance }}: Process Open-exec Down"
description: "{{ $labels.instance }}: Process Open-exec has been down for more than 1m"
value: "{{ $value }}"
- alert: ProcessActivityDown
expr: (namedprocess_namegroup_num_procs{groupname="map[:sys#activity-exec.jar]"}) == 0
for: 1m
labels:
severity: warning
annotations:
summary: "{{ $labels.instance }}: Process Activity-exec Down"
description: "{{ $labels.instance }}: Process Activity-exec has been down for more than 1m"
value: "{{ $value }}"
kubectl apply -f prometheus/
kubectl delete pod -n monitoring prometheus-b58f6d4c7-v8m7x