CastawayLabs / cachet-monitor

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

panic #29

Closed maitrey0da closed 8 years ago

maitrey0da commented 8 years ago

Hello,

I have some issues with cachet-monitor

$ work/bin/cachet-monitor -c="config.json"                                                                                                                          ⮂  
2016/04/27 14:29:14 /home/maitrey0da/work/src/github.com/castawaylabs/cachet-monitor/main.go:12: System: maitreyoda, Interval: 5 second(s), API: http://meteo.perdu.com/api/v1
2016/04/27 14:29:14 /home/maitrey0da/work/src/github.com/castawaylabs/cachet-monitor/main.go:13: Starting 1 monitors:
2016/04/27 14:29:14 /home/maitrey0da/work/src/github.com/castawaylabs/cachet-monitor/main.go:15:  Test: GET http://www.perdu.com/ & Expect HTTP 200
2016/04/27 14:29:14 /home/maitrey0da/work/src/github.com/castawaylabs/cachet-monitor/main.go:21: 
2016/04/27 14:29:19 /home/maitrey0da/work/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: http://www.perdu.com/ 100.00% Down at 1461760159. Threshold: 80.00%
2016/04/27 14:29:24 /home/maitrey0da/work/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: http://www.perdu.com/ 100.00% Down at 1461760164. Threshold: 80.00%
2016/04/27 14:29:29 /home/maitrey0da/work/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: http://www.perdu.com/ 100.00% Down at 1461760169. Threshold: 80.00%
2016/04/27 14:29:34 /home/maitrey0da/work/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: http://www.perdu.com/ 100.00% Down at 1461760174. Threshold: 80.00%
2016/04/27 14:29:39 /home/maitrey0da/work/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: http://www.perdu.com/ 100.00% Down at 1461760179. Threshold: 80.00%
2016/04/27 14:29:44 /home/maitrey0da/work/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: http://www.perdu.com/ 100.00% Down at 1461760184. Threshold: 80.00%
2016/04/27 14:29:49 /home/maitrey0da/work/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: http://www.perdu.com/ 100.00% Down at 1461760189. Threshold: 80.00%
2016/04/27 14:29:54 /home/maitrey0da/work/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: http://www.perdu.com/ 100.00% Down at 1461760194. Threshold: 80.00%
2016/04/27 14:29:59 /home/maitrey0da/work/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: http://www.perdu.com/ 100.00% Down at 1461760199. Threshold: 80.00%
2016/04/27 14:30:04 /home/maitrey0da/work/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: http://www.perdu.com/ 100.00% Down at 1461760204. Threshold: 80.00%
2016/04/27 14:30:04 /home/maitrey0da/work/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=0x461d1f]

goroutine 32 [running]:
panic(0x746600, 0xc82000e110)
    /usr/local/go/src/runtime/panic.go:481 +0x3e6
github.com/castawaylabs/cachet-monitor/cachet.(*Monitor).AnalyseData(0xc8200560e0)
    /home/maitrey0da/work/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:95 +0x85f
github.com/castawaylabs/cachet-monitor/cachet.(*Monitor).Run(0xc8200560e0)
    /home/maitrey0da/work/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:38 +0xdb
created by main.main
    /home/maitrey0da/work/src/github.com/castawaylabs/cachet-monitor/main.go:26 +0x78d

my config file

{
  "api_url": "http://meteo.perdu.com/api/v1",
  "api_token": "...",
  "interval": 5,
  "monitors": [
    {
      "name": "Test",
      "url": "http://www.perdu.com/",
      "metric_id": 0,
      "threshold": 80,
      "component_id": null,
      "expected_status_code": 200,
      "strict_tls": false
    }
  ],
  "insecure_api": true
}
go version go1.6.2 linux/amd64
craftbyte commented 8 years ago

Looks to me like there is a null pointer when trying to access the Cachet API. Can you check if the Cachet server is working?

maitrey0da commented 8 years ago

It's working now, thanks to a new config file. The behavior is odd