るいすのブログ

オタクエンジニアの雑記

Grafana CLI を使って特定のアラートをミュートにする


こんなファイルを置く

$ cat ~/.grafana/prd

[ENVIRONMENT]
export GF_ENV="prd"
export GF_API_URL='https://grafana/api'
export GF_AUTH_HEADER="Authorization: Bearer $GF_TOKEN"

[main]
export GF_TOKEN=""

プロジェクトを設定する

source grafana-cli config set-env prd <org_name>

叩けるか確認

$ grafana-cli alerts

ALERT_ID    ALERT_STATE    DASHBOARD                                                   ALERT_NAME
===========================================================================================================================================================
10          ok           temperature                                               CPU Temperature Alert
38          ok           nomad                                                     CPU Usage alert
30          ok           network                                                   CPU alert
17          ok           alerts                                                    Free disk space (ext4) alert
18          ok           alerts                                                    Free disk space (xfs) alert
6           ok           proxmox-via-prometheus                                    Guests CPU usage alert
5           ok           proxmox-via-prometheus                                    Guests Disk usage alert
24          ok           proxmox-via-prometheus                                    Guests memory usage alert
43          paused       alerts                                                    IO Wait
37          ok           nomad                                                     Job Status alert
39          ok           nomad                                                     Memory Usage alert
49          ok           nicehash                                                  NiceHash GPU Load alert
48          alerting     nicehash                                                  NiceHash GPU Temperature alert
47          ok           alerts                                                    Nicehash Active Device alert
44          ok           temperature                                               Nicehash GPU Temperature alert
26          ok           alerts                                                    Ping Alert
41          ok           temperature                                               Proxmox3 Storage alert
34          ok           network                                                   RAM Free alert
13          ok           temperature                                               Storage Temperature alert
11          ok           temperature                                               Storage alert
12          ok           temperature                                               Storage alert
45          ok           xfs-fragmentation                                         XFS Fragmentation in Percent alert
19          ok           alerts                                                    mdadm alert
16          ok           alerts                                                    memory alert
40          ok           alerts                                                    minio alert
15          ok           alerts                                                    mysqld
46          ok           alerts                                                    mysqlrouter process alert
32          ok           alerts                                                    nginx alert
27          ok           alerts                                                    redis proccess alert
28          ok           alerts                                                    redis sentinel alert
33          ok           alerts                                                    samba alert
42          ok           alerts                                                    samba alert
21          ok           alerts                                                    sshd alert

特定のアラートをミュートする

$ grafana-cli alerts pause -i 48

何ヶ月ぶりの記事だろうか。 最近はここで記事を書いてます。