CastawayLabs / cachet-monitor

Distributed monitoring plugin for CachetHQ
https://castawaylabs.github.io/cachet-monitor/
MIT License
439 stars 126 forks source link

Error creating incident #30

Closed ivanbreet closed 8 years ago

ivanbreet commented 8 years ago

Hi,

We have cachet-monitor setup to check multiple applications, and after one of the service checks goes above the downtime it crashes.

The following error as per our logs:

2016/05/18 08:01:02 /usr/local/go/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: https://www.xyz.com 90.00% Down at 1463558462. Threshold: 80.00%
2016/05/18 08:01:02 /usr/local/go/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:93: Creating incident...
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x461bef]

goroutine 4472174 [running]:
panic(0x746440, 0xc82000a0f0)
    /usr/local/go/src/runtime/panic.go:464 +0x3e6
github.com/castawaylabs/cachet-monitor/cachet.(*Monitor).AnalyseData(0xc8200480e0)
    /usr/local/go/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:95 +0x85f
github.com/castawaylabs/cachet-monitor/cachet.(*Monitor).Run(0xc8200480e0)
    /usr/local/go/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:38 +0xdb
created by main.main
    /usr/local/go/src/github.com/castawaylabs/cachet-monitor/main.go:26 +0x78d

We love this app, and would really appreciate it if this issue can be resolved.

matejkramny commented 8 years ago

Sure, I'll take a look.

We abandoned cachet after the graphs took forever to load, but they fixed this now so we will try again. The plugin will be fixed and the panics should go away hopefully.

ivanbreet commented 8 years ago

Thank you for the quick response!

matejkramny commented 8 years ago

Ah this isn't a bug, though it should be prevented..

Your configuration is missing component_id for the monitor. It is optional, so its a pointer.. It cannot dereference nil so panics.

I started work on making cachet-monitor slicker tho. Cheers for nudge ;)