Skip to content

Instantly share code, notes, and snippets.

View get-alerts-list-1day.sh
#!/bin/bash
MACKEREL_APIKEY=<YOUR_MACKEREL_APIKEY>
LIMIT=100
DATE_FROM=$(date -d '1 day ago' +%s)
# 一回目
JSON_FIRST=$(
curl -GsS \
-X GET \
View post-mackerel-alerts-count.sh
#!/bin/bash
MACKEREL_APIKEY=<YOUR_MACKEREL_APIKEY>
SERVICE_NAME="alerts-count"
NOW=$(date +%s)
ALERT_LOG_FILE="/path/to/logfile"
function push_mackerel_alerts_count () {
curl -sS \
-X POST \
View get-alerts-list-date-range.sh
#!/bin/bash
MACKEREL_APIKEY=<YOUR_MACKEREL_APIKEY>
LIMIT=100
DATE_FROM=$(date -d "2020-12-15 23:00:00" +%s) #取得したいアラートの開始日時
DATE_TO=$(date -d "2020-12-16 00:00:00" +%s) #取得したいアラートの終了日時
# ヘッダーを出力
echo -e "hostid\tstatus\tmonitorId\ttype\thostId\tvalue\tmessage\treason\topenedAt\tclosedAt"