1
我試圖在來自bosun的elasticsearch中插入一個警報,但我不知道如何填充變量$timestamp
(看看我的示例)與當前時間。我可以使用bosun.conf
中的功能嗎?我想喜歡now()
。 有人可以幫我嗎?如何處理復星配置中的時間戳?
這是一個配置示例的摘錄:
macro m1
{
$timestamp = **???**
}
notification http_crit
{
macro = m1
post = http://xxxxxxx:9200/alerts/http/
body = {"@timestamp":$timestamp,"level":"critical","alert_name":"my_alert"}
next = http_crit
timeout = 1m
}
alert http
{
template = elastic
$testHTTP = lscount("logstash", "", "_type:stat_http,http_response:200", "1m", "5m", "")
$testAvgHTTP = avg($testHTTP)
crit = $testAvgHTTP < 100
critNotification = http_crit
}
謝謝您的回答。這對於模板來說是完美的,但我不能在宏或通知中使用它,對嗎? –