CastawayLabs / cachet-monitor

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

Setup monitor #122

Closed ghost closed 3 years ago

ghost commented 4 years ago

Hello. I have a worry I can't get the monitor up, while the site is online.

2020-03-13_22h26_59

{ "api": { "url": "https://website.com", "token": "token", "insecure": false }, "date_format": "02/01/2006 15:04:05 MST", "monitors": [ { "name": "Neko-Love", "target": "https://neko-love.xyz", "strict": true, "method": "POST", "component_id": 1, "metric_id": 4, "template": { "investigating": { "subject": "{{ .Monitor.Name }} - {{ .SystemName }}", "message": "{{ .Monitor.Name }} check **failed** (server time: {{ .now }})\n\n{{ .FailReason }}" }, "fixed": { "subject": "I HAVE BEEN FIXED" } }, "interval": 1, "timeout": 1, "threshold": 80, "headers": { "Authorization": "Basic <hash>" }, "expected_status_code": 200, "expected_body": "P.*NG" } ] }

andelhie commented 4 years ago

So I just setup my system up and notice a couple thing.

I removed a lot of the default settings like "expected_body": "P.*NG"

Also I had to switch this setting "method": "POST" to GET not Post and it started to work for me.

Also you will need to get the correct componet_id and metric_id. To get them you have to curl your server. Here is a page I used to help me find this and i used PostMan and my api key as auth.

https://docs.cachethq.io/reference#get-components