我第一次使用Bosun配置时遇到了奇怪的行为。 我似乎只是在第一次收到警报时才收到邮件。 我肯定会误解某些东西..这是我的.conf文件:
smtpHost = ${env.BOSUN_MAIL_SERV}
smtpUsername = ${env.BOSUN_MAIL_USER}
smtpPassword = ${env.BOSUN_MAIL_PASS}
emailFrom = ${env.BOSUN_MAIL_FROM}
httpListen = :8070
timeAndDate = 31
stateFile = ../bosun.state
ledisDir = ../ledis_data
checkFrequency = 10s
logstashElasticHosts = ${env.BOSUN_ES_HOSTS}
notification onError {
email = elkarel@company.net
print = true
}
template generic {
subject = Test alert
body = `<p>Alert: {{.Alert.Name}} triggered </p>`
}
alert company.errors.rate.exceeds0 {
template = generic
unknownIsNormal = true
runEvery = 1
$notes = "The rate of errors exceeds 1."
crit = 1
critNotification = onError
}
如您所见,始终设置crit
。然而,什么都不会发生。 Bosun输出是这样的:
elkarel@thinkPad-E550:~/Bosun$ ./bosun-linux-amd64-0.5.0-rc3 -c company.conf
2016/05/18 13:14:45 enabling syslog
2016/05/18 13:14:45 info: search.go:194: Loading last datapoints from redis
2016/05/18 13:14:45 info: search.go:201: Done
2016/05/18 13:14:45 info: bolt.go:53: RestoreState
2016/05/18 13:14:45 info: bolt.go:65: RestoreState done in 23.954µs
2016/05/18 13:14:45 info: check.go:513: check alert company.errors.rate.exceeds0 start
2016/05/18 13:14:45 info: check.go:537: check alert company.errors.rate.exceeds0 done (463.184µs): 1 crits, 0 warns, 0 unevaluated, 0 unknown
2016/05/18 13:14:45 info: web.go:154: bosun web listening on: :8070
2016/05/18 13:14:45 info: web.go:155: tsdb host:
2016/05/18 13:14:45 info: alertRunner.go:55: runHistory on company.errors.rate.exceeds0 took 11.525239ms
2016/05/18 13:14:55 info: check.go:513: check alert company.errors.rate.exceeds0 start
2016/05/18 13:14:55 info: check.go:537: check alert company.errors.rate.exceeds0 done (418.716µs): 1 crits, 0 warns, 0 unevaluated, 0 unknown
2016/05/18 13:14:55 info: alertRunner.go:55: runHistory on company.errors.rate.exceeds0 took 2.298315ms
2016/05/18 13:15:05 info: notify.go:147: Batching and sending unknown notifications
2016/05/18 13:15:05 info: notify.go:177: Done sending unknown notifications
2016/05/18 13:15:05 info: check.go:513: check alert company.errors.rate.exceeds0 start
2016/05/18 13:15:05 info: check.go:537: check alert company.errors.rate.exceeds0 done (380.23µs): 1 crits, 0 warns, 0 unevaluated, 0 unknown
2016/05/18 13:15:05 info: alertRunner.go:55: runHistory on company.errors.rate.exceeds0 took 919.933µs
2016/05/18 13:15:15 info: check.go:513: check alert company.errors.rate.exceeds0 start
2016/05/18 13:15:15 info: check.go:537: check alert company.errors.rate.exceeds0 done (351.148µs): 1 crits, 0 warns, 0 unevaluated, 0 unknown
2016/05/18 13:15:15 info: alertRunner.go:55: runHistory on company.errors.rate.exceeds0 took 807.104µs
2016/05/18 13:15:25 info: notify.go:147: Batching and sending unknown notifications
2016/05/18 13:15:25 info: notify.go:177: Done sending unknown notifications
2016/05/18 13:15:25 info: check.go:513: check alert company.errors.rate.exceeds0 start
2016/05/18 13:15:25 info: check.go:537: check alert company.errors.rate.exceeds0 done (439.26µs): 1 crits, 0 warns, 0 unevaluated, 0 unknown
2016/05/18 13:15:25 info: alertRunner.go:55: runHistory on company.errors.rate.exceeds0 took 2.429369ms
所以他知道警报导致了一个危急状态,但没有发出任何通知。
但是,如果我将警报名称更改为company.errors.rate.exceeds0_newname
,则会触发通知并邮件到达:
elkarel@thinkPad-E550:~/Bosun$ ./bosun-linux-amd64-0.5.0-rc3 -c company.conf
2016/05/18 13:18:35 enabling syslog
2016/05/18 13:18:35 info: search.go:194: Loading last datapoints from redis
2016/05/18 13:18:35 info: search.go:201: Done
2016/05/18 13:18:35 info: bolt.go:53: RestoreState
2016/05/18 13:18:35 info: bolt.go:65: RestoreState done in 28.431µs
2016/05/18 13:18:35 info: check.go:513: check alert company.errors.rate.exceeds_newname start
2016/05/18 13:18:35 info: check.go:537: check alert company.errors.rate.exceeds_newname done (638.843µs): 1 crits, 0 warns, 0 unevaluated, 0 unknown
2016/05/18 13:18:35 info: web.go:154: bosun web listening on: :8070
2016/05/18 13:18:35 info: web.go:155: tsdb host:
2016/05/18 13:18:35 info: alertRunner.go:55: runHistory on company.errors.rate.exceeds_newname took 2.380886ms
2016/05/18 13:18:35 info: notify.go:57: Test alert
2016/05/18 13:18:36 info: notify.go:115: relayed alert company.errors.rate.exceeds_newname{} to [elkarel@company.net] sucessfully. Subject: 10 bytes. Body: 99 bytes.
2016/05/18 13:18:45 info: check.go:513: check alert company.errors.rate.exceeds_newname start
2016/05/18 13:18:45 info: check.go:537: check alert company.errors.rate.exceeds_newname done (558.396µs): 1 crits, 0 warns, 0 unevaluated, 0 unknown
2016/05/18 13:18:45 info: alertRunner.go:55: runHistory on company.errors.rate.exceeds_newname took 746.837µs
2016/05/18 13:18:55 info: notify.go:147: Batching and sending unknown notifications
2016/05/18 13:18:55 info: notify.go:177: Done sending unknown notifications
2016/05/18 13:18:55 info: check.go:513: check alert company.errors.rate.exceeds_newname start
2016/05/18 13:18:55 info: check.go:537: check alert company.errors.rate.exceeds_newname done (394.645µs): 1 crits, 0 warns, 0 unevaluated, 0 unknown
2016/05/18 13:18:55 info: alertRunner.go:55: runHistory on company.errors.rate.exceeds_newname took 956.957µs
2016/05/18 13:19:05 info: check.go:513: check alert company.errors.rate.exceeds_newname start
2016/05/18 13:19:05 info: check.go:537: check alert company.errors.rate.exceeds_newname done (404.464µs): 1 crits, 0 warns, 0 unevaluated, 0 unknown
2016/05/18 13:19:05 info: alertRunner.go:55: runHistory on company.errors.rate.exceeds_newname took 832.393µs
2016/05/18 13:19:15 info: notify.go:147: Batching and sending unknown notifications
通知仅显示在&#34; new&#34;警报。这是博森的工作方式吗?我是否必须重新发送通知,直到有人回复它?
邮件服务器是gmail。
提前致谢!
答案 0 :(得分:3)
是的,当警报从正常转为警告或从警告转为暴击时,Bosun仅发送通知。但是,您可以链接通知甚至指定
var keys = {};
$(document).keydown(function (e) {
keys[e.which] = true;
printKeys();
});
$(document).keyup(function (e) {
delete keys[e.which];
printKeys();
});
function printKeys() {
var html = '';
for (var i in keys) {
if (!keys.hasOwnProperty(i)) continue;
html += '<p>' + i + '</p>';
}
$('#out').html(html);
}
这样Bosun每分钟都会发送通知,直到警报得到确认。