我正在尝试从 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
}