# 每周五6点20定时停止告警
代码语言:javascript
复制#!/bin/bash
now_date=`date %F`
future_date=`date %F --date=" 3 day"`
curl 'http://172.16.30.250:9093/api/v2/silences'
-H 'Content-Type: application/json'
--data '{"matchers":[{"name":"alertname","value":"gf_RabbitMQ_published","isRegex":false},{"name":"instance","value":"gf_RabbitMQ","isRegex":false}],"startsAt":"'${now_date}'T22:20:00.000","endsAt":"'${future_date}'T23:00:00.000","createdBy":"jaylen","comment":"tmp","id":null}'
--compressed --insecure
##########
curl 'http://172.16.30.250:9093/api/v2/silences'
-H 'Content-Type: application/json'
--data '{"matchers":[{"name":"instance","value":"gf-md_hq","isRegex":false}],"startsAt":"'${now_date}'T22:20:00.000","endsAt":"'${future_date}'T23:00:00.000","createdBy":"jaylen","comment":"tmp","id":null}'
--compressed --insecure
############
curl 'http://172.16.30.250:9093/api/v2/silences'
-H 'Content-Type: application/json'
--data '{"matchers":[{"name":"instance","value":"quote-md_hq","isRegex":false}],"startsAt":"'${now_date}'T22:20:00.000","endsAt":"'${future_date}'T23:00:00.000","createdBy":"jaylen","comment":"tmp","id":null}'
--compressed --insecure
##########
curl 'http://172.16.30.250:9093/api/v2/silences'
-H 'Content-Type: application/json'
--data '{"matchers":[{"name":"alertname","value":"ait0_gm_stock","isRegex":false},{"name":"instance","value":"ait0-gm_hq","isRegex":false}],"startsAt":"'${now_date}'T22:20:00.000","endsAt":"'${future_date}'T23:00:00.000","createdBy":"jaylen","comment":"tmp","id":null}'
--compressed --insecure
###########
curl 'http://172.16.30.250:9093/api/v2/silences'
-H 'Content-Type: application/json'
--data '{"matchers":[{"name":"alertname","value":"ait0_gm_future","isRegex":false},{"name":"instance","value":"ait0-gm_future_hq","isRegex":false}],"startsAt":"'${now_date}'T22:20:00.000","endsAt":"'${future_date}'T23:00:00.000","createdBy":"jaylen","comment":"tmp","id":null}'
--compressed --insecure
########
curl 'http://172.16.30.250:9093/api/v2/silences'
-H 'Content-Type: application/json'
--data '{"matchers":[{"name":"instance","value":"airm-quoteproxy_hq","isRegex":false}],"startsAt":"'${now_date}'T22:20:00.000","endsAt":"'${future_date}'T23:00:00.000","createdBy":"jaylen","comment":"tmp","id":null}'
--compressed --insecure
#########
curl 'http://172.16.30.250:9093/api/v2/silences'
-H 'Content-Type: application/json'
--data '{"matchers":[{"name":"instance","value":"airm-nano_hq","isRegex":false}],"startsAt":"'${now_date}'T22:20:00.000","endsAt":"'${future_date}'T23:00:00.000","createdBy":"jaylen","comment":"tmp","id":null}'
--compressed --insecure
########
curl 'http://172.16.30.250:9093/api/v2/silences'
-H 'Content-Type: application/json'
--data '{"matchers":[{"name":"instance","value":"gf-md_hq_qianhai","isRegex":false}],"startsAt":"'${now_date}'T22:20:00.000","endsAt":"'${future_date}'T23:00:00.000","createdBy":"jaylen","comment":"tmp","id":null}'
--compressed --insecure
##########
curl 'http://172.16.30.250:9093/api/v2/silences'
-H 'Content-Type: application/json'
--data '{"matchers":[{"name":"instance","value":"airm-fortex_hq","isRegex":false}],"startsAt":"'${now_date}'T22:20:00.000","endsAt":"'${future_date}'T23:00:00.000","createdBy":"jaylen","comment":"tmp","id":null}'
--compressed --insecure
# 其它时间段停止静默告警
代码语言:javascript
复制#!/bin/bash
now_date=`date %F`
future_date=`date %F --date=" 1 day"`
curl 'http://172.16.30.250:9093/api/v2/silences'
-H 'Content-Type: application/json'
--data '{"matchers":[{"name":"alertname","value":"ait0_gm_stock","isRegex":false},{"name":"instance","value":"ait0-gm_hq","isRegex":false}],"startsAt":"'${now_date}'T07:35:00.000","endsAt":"'${future_date}'T23:00:00.000","createdBy":"jaylen","comment":"tmp","id":null}'
--compressed --insecure
###########
curl 'http://172.16.30.250:9093/api/v2/silences'
-H 'Content-Type: application/json'
--data '{"matchers":[{"name":"alertname","value":"ait0_gm_future","isRegex":false},{"name":"instance","value":"ait0-gm_future_hq","isRegex":false}],"startsAt":"'${now_date}'T07:35:00.000","endsAt":"'${future_date}'T23:00:00.000","createdBy":"jaylen","comment":"tmp","id":null}'
--compressed --insecure