2

I am trying to get an alert notification from bosun(using docker image) when my cpu usage is high at client vm using bosun's UI, it is showing up critical condition but not sending the notifications, also finding a way to debug the config file. My config file contains-

tsdbHost = localhost:4242
stateFile = /data/bosun.state

template test {
    body = `Alert definition:
    Name: {{.Alert.Name}}
    Crit: {{.Alert.Crit}}
    Tags:
    <table>
        {{range $k, $v := .Group}}
            <tr><td>{{$k}}</td><td>{{$v}}</td></tr>
        {{end}}
    </table>`
    subject = {{.Last.Status}}: {{.Alert.Name}} on {{.Group.host}}
}

notification json {
    post = http://localhost:8080/alert
    body = {"text": {{.|json}}}
    contentType = application/json
    next = json
    timeout = 5s
    print = true
}

alert test {
    template = test
    $speed = avg(q("sum:rate{counter,,1}:linux.cpu{host=aaa}", "1h", ""))
    crit = $speed>195
    warn = $speed>180
    critNotification = json
    warnNotification = json
}

my log file "./var/log/supervisor/bosun-stderr---supervisor-nhXZKo.log" contains-

2015/12/17 06:27:19 info: search.go:199: Backing up last data to redis
2015/12/17 06:29:20 info: search.go:199: Backing up last data to redis
2015/12/17 06:30:08 info: notify.go:122: Batching and sending unknown notifications
2015/12/17 06:30:08 info: notify.go:152: Done sending unknown notifications
2015/12/17 06:30:13 info: bolt.go:79: wrote notifications: 48.00B
2015/12/17 06:30:13 info: bolt.go:79: wrote silence: 140.00B
2015/12/17 06:30:13 info: bolt.go:79: wrote status: 767.00B
2015/12/17 06:30:13 info: bolt.go:103: save to db complete
2015/12/17 06:31:20 info: search.go:199: Backing up last data to redis
2015/12/17 06:33:21 info: search.go:199: Backing up last data to redis

and my server file, which is locally running contains-

 package main
import (
        "fmt"
        "log"
        "net/http"
)
func handleAlerts(res http.ResponseWriter, req *http.Request) {
        fmt.Print(req.Body)
        fmt.Printf("request enjoy")
}
func main() {
        http.HandleFunc("/alert", handleAlerts)
        fmt.Printf("Starting server on 8080...")
        err := http.ListenAndServe(":8080", nil)
        if err != nil {
                fmt.Println("Alerts: Server Down: ", err)
                log.Fatal("Alerts: Server Down: ", err)
        }
}
ell
  • 21
  • 2

1 Answers1

0

It seems the two most common reasons people don't get any notifications are:

  1. Bosun is running in quiet mode which suppresses all notifications. This is the case when bosun is run with the -q switch.
  2. Misunderstanding Bosun's alerting workflow. Incidents that have been Critical in their lifetime (haven't been closed) will not re-notify (see The lifetime of an incident](http://bosun.org/usage#the-lifetime-of-an-incident) section of the documentation.
Kyle Brandt
  • 26,938
  • 37
  • 124
  • 165