Code Monkey home page Code Monkey logo

cachet-monitor's People

Contributors

axnsan12 avatar echobob avatar faizshukri avatar jiangytcn avatar matejkramny avatar mathieudoyon avatar osallou avatar sgreene570 avatar soulou avatar srabouin avatar to-kn avatar tolbxela avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cachet-monitor's Issues

URLs always reporting down

Hello,

I am attempting to setup a check and it seems no matter what URL I give it it fails.

Here is my config:

{
        "api_url": "http://status.redacted-domain.com/api/v1",
        "api_token": "redacted-token",
        "insecure_api": true,
        "monitors": [{
                "name": "Google",
                "url": "http://www.google.com",
                "method": "get",
                "strict_tls": true,
                "interval": 60,
                "timeout": 10,
                "metric_id": 1,
                "component_id": 12,
                "threshold": 80,
                "expected_status_code": 200
        }],
        "system_name": "Node-1",
        "log_path": ""
}

If I CURL the address I do get a 200 back:

root@phobos:~/temp# curl -I http://www.google.com
HTTP/1.1 200 OK
Date: Sun, 03 Jul 2016 04:36:35 GMT
Expires: -1

Server output:

root@phobos:~/temp# ./cachet-monitor_linux_amd64 -c cachet.json
2016/07/03 00:36:20 /Users/m/p/gospace/src/github.com/castawaylabs/cachet-monitor/cli/main.go:52: System: Node-1
API: http://status.redacted-domain.com/api/v1
Monitors: 1

2016/07/03 00:36:20 /Users/m/p/gospace/src/github.com/castawaylabs/cachet-monitor/monitor.go:53:  Starting Google: 60 seconds check interval
 - GET http://www.google.com
2016/07/03 00:36:20 /Users/m/p/gospace/src/github.com/castawaylabs/cachet-monitor/monitor.go:57:  - Expect HTTP 200
2016/07/03 00:36:20 /Users/m/p/gospace/src/github.com/castawaylabs/cachet-monitor/monitor.go:63:  - Log lag to metric id 1
2016/07/03 00:36:20 /Users/m/p/gospace/src/github.com/castawaylabs/cachet-monitor/monitor.go:66:  - Update component id 12

2016/07/03 00:36:21 /Users/m/p/gospace/src/github.com/castawaylabs/cachet-monitor/monitor.go:175: Google 0.00%/80.00% down at 1467520581

Also when it reports down it reports:

Get http://www.google.com.com: net/http: request canceled (Client.Timeout exceeded while awaiting headers)

Thanks for the help.

Multiple Monitors

It looks like it's possible to configure multiple monitors from the config file, but I must have something wrong in my syntax (I'm guessing it's brackets). Can you add an example with a config for multiple monitors?

Creating Incident for Incorrect Component?

This is more of an odd situation that doesn't occur every time but I decided to mention it in case someone else might be having the same issue.

At times the newly created incident gets applied to the incorrect component. I have tested this by purposely taking down a site and the majority of time it works as planned but once in a while I get the incident going astray.

Any one else seen or experienced this? I never received this prior to the latest release and I have double checked the component ID's in my config file with the ones applied when going to mysite/api/v1/components.

Support for modified or localized incident text

Since Cachet supports different locales, is it doable to have the text of the reported incident localized somehow? This can be solved also if a one can change the text itself via configuration for example.

Cannot parse component body

Cachet v2.2.2 and monitor v2.0

Got this error when it try to fetch component status.

/monitor.go:177: Site creating incident. Monitor is down: Unexpected response code: 502. Expected 200
/incident.go:36: cannot fetch component: Cannot parse component body:
{
    "data":{
        "id":1,
        "name":"API",
        "description":"",
        "link":"",
        "status":"3",
        "order":1,
        "group_id":1,
        "created_at":"2016-04-08 15:07:49",
        "updated_at":"2016-05-20 16:50:25",
        "deleted_at":null,
        "enabled":true,
        "status_name":"Partial Outage",
        "tags":{
            "":""
        }
    }
}
Err = json: cannot unmarshal string into Go value of type int

Error creating incident

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.

go install not working

I'm receiving an error on Step#2 of "How to run" trying to "go install" on Red Hat Linux.
1.I installed golang successfully and setup a golang workspace as follows:
mkdir ~/workspace
echo ‘export GOPATH=”$HOME/workspace”’ >> ~/.bashrc
source ~/.bashrc

2.Then I enter:
go install github.com/castawaylabs/cachet-monitor
and get this back:
can't load package: package github.com/castawaylabs/cachet-monitor: cannot find package github.com/castawaylabs/cachet-monitor" in any of:
/usr/lib/golang/src/github.com/castawaylabs/cachet-monitor (from $GOBOOT)"
/root/workspace/src/github.com/castawaylabs/cachet-monitor (from $GOPATH)

3.I did try this possible solution which I found while researching, but still had same problem.
mkdir /go
export GOPATH=/go
go install github.com/castawaylabs/cachet-monitor

Any plans for other checks?

I'l like to use this great tool for other stuff than HTTP. Any plans to make plugins possible for eg DNS probing?

panic

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

How to properly install and run cachet-monitor

Good afternoon,

I've searched and read through the documentation as well as searched online for instructions, but I am not sure if I installed it properly. I did a git clone and git checkout, created a new cachet-monitor.config.json but when trying to run it, I get "cachet-monitor: command not found"

Please advise if you can.

ICMP Test?

I know that cachet-monitor can ping URL but I would like to use this to also check if an actual device is responding. Is it possible with cachet-monitor and I am just missing something in the config file? Even better would be specifying a port as well...

Component Partial Outage -> Major Outage

cachet-monitor can be run from many servers.

During an incident, the component would be updated to partial outage. It would be logical that if there are many incidents for the component, it would be a major outage.

Possible to install via go cli?

Is it possible to install via go install? Can't really think of why downloading a prebuilt package while go is really fast enough to build on every machine.

The request cannot be fulfilled due to bad syntax.

2016/03/07 22:06:23 /go/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: https://example.com/ping 90.00% Down at 1457388383. Threshold: 80.00%
2016/03/07 22:06:23 /go/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:93: Creating incident...
2016/03/07 22:06:23 /go/src/github.com/castawaylabs/cachet-monitor/cachet/incident.go:72: 400 {"errors":[{"id":"88f7de5f-37d9-4737-8f70-da1369c27c1b","status":400,"title":"Bad Request","detail":"The request cannot be fulfilled due to bad syntax.","meta":{"details":["The status format is invalid."]}}]}
2016/03/07 22:06:23 /go/src/github.com/castawaylabs/cachet-monitor/cachet/incident.go:85: Could not create/update incident!
2016/03/07 22:06:28 /go/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: https://example.com/ping 100.00% Down at 1457388388. Threshold: 80.00%
2016/03/07 22:07:28 /go/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: https://example.com/ping 70.00% Down at 1457388448. Threshold: 80.00%
2016/03/07 22:07:28 /go/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:114: Updating incident to resolved...
2016/03/07 22:07:28 /go/src/github.com/castawaylabs/cachet-monitor/cachet/incident.go:72: 400 {"errors":[{"id":"f95b7980-d9e9-4930-9576-dafed3dce1cf","status":400,"title":"Bad Request","detail":"The request cannot be fulfilled due to bad syntax.","meta":{"details":["The status format is invalid."]}}]}
2016/03/07 22:07:28 /go/src/github.com/castawaylabs/cachet-monitor/cachet/incident.go:85: Could not create/update incident!
2016/03/07 22:07:33 /go/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: https://example.com/ping 60.00% Down at 1457388453. Threshold: 80.00%

However it does appear to create the incident:

SS

Attach to a Component

Support is available, but is untested.

When an incident goes live, it has an option of updating a component.

Components or Incidents not Reverting back to Fixed or Operational

At the moment the incidents are being created and the components are being set to either "Partial Outage" or "Major Outage", as planned, but they don't revert back to "Fixed" or "Operational". Is there something that I am overlooking?

Here is a screenshot of cachet-monitor running. The creating incident works but not the resolved downtime...
image

Monitor Code:
"monitors": [
{
"name": "Phone Directory",
"url": "Site",
"threshold": 80,
"component_id": 2,
"interval": 5,
"timeout": 5,
"expected_status_code": 200,
"strict_tls": true
}

Any Ideas?

Does not update component

I am trying to use this project on ubuntu.
My config file:
{ "api_url": "https://status.**.com/api/v1", "api_token": "**", "insecure_api": false, "monitors": [ { "name": "Main website", "url": "https://**.com", "component_id": 1, "interval": 10, "timeout": 30, "expected_status_code": 200, "strict_tls": false } ], "system_name": "** system-status" }
Output example:

`System: ** system-status
API: https://status.**.com/api/v1
Monitors: 1
 Starting Main website: 10 seconds check interval
 - GET https://**.com
 - Expect HTTP 200
 - Update component id 1
Main website 0.00%/100.00% down at 1483290709
Main website 0.00%/100.00% down at 1483290719
Main website 0.00%/100.00% down at 1483290729
Main website 0.00%/100.00% down at 1483290739
Main website 0.00%/100.00% down at 1483290749
Main website 0.00%/100.00% down at 1483290759
Main website 0.00%/100.00% down at 1483290769
Main website 0.00%/100.00% down at 1483290779
Main website 0.00%/100.00% down at 1483290789
Main website is now saturated
Main website 0.00%/100.00% down at 1483290799`

Tried to change certificate parameters.
Checked the api key.

The GET is getting to the server, the only problem its that it doesn't update the component.

Should it update the component that way?

Monitor stop working after some time

Hi !

I was using cachet-monitor for about a day or so and noticed that is wasn't properly reporting incident to Cachet.

When I looked at the logs, here what I found:

goroutine 5785 [chan receive]:
net/http.func·016()
    /usr/src/go/src/net/http/transport.go:507 +0x65
created by net/http.func·017
    /usr/src/go/src/net/http/transport.go:513 +0xba

goroutine 5857 [chan receive]:
net/http.func·016()
    /usr/src/go/src/net/http/transport.go:507 +0x65
created by net/http.func·017
    /usr/src/go/src/net/http/transport.go:513 +0xba

goroutine 5712 [chan receive]:
net/http.func·016()
    /usr/src/go/src/net/http/transport.go:507 +0x65
created by net/http.func·017
    /usr/src/go/src/net/http/transport.go:513 +0xba

goroutine 5940 [IO wait]:
net.(*pollDesc).Wait(0xc208289aa0, 0x72, 0x0, 0x0)
    /usr/src/go/src/net/fd_poll_runtime.go:84 +0x47
net.(*pollDesc).WaitRead(0xc208289aa0, 0x0, 0x0)
    /usr/src/go/src/net/fd_poll_runtime.go:89 +0x43
net.(*netFD).Read(0xc208289a40, 0xc20823a000, 0x1000, 0x1000, 0x0, 0x7fc61e2dab70, 0xc208232ab0)
    /usr/src/go/src/net/fd_unix.go:242 +0x40f
net.(*conn).Read(0xc208034498, 0xc20823a000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
    /usr/src/go/src/net/net.go:121 +0xdc
net/http.noteEOFReader.Read(0x7fc61e2dc060, 0xc208034498, 0xc2082b5bd8, 0xc20823a000, 0x1000, 0x1000, 0x7fc61e2c9010, 0x0, 0x0)
    /usr/src/go/src/net/http/transport.go:1270 +0x6e
net/http.(*noteEOFReader).Read(0xc20822e0c0, 0xc20823a000, 0x1000, 0x1000, 0xc207ffcbb5, 0x0, 0x0)
    <autogenerated>:125 +0xd4
bufio.(*Reader).fill(0xc2080ef500)
    /usr/src/go/src/bufio/bufio.go:97 +0x1ce
bufio.(*Reader).Peek(0xc2080ef500, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
    /usr/src/go/src/bufio/bufio.go:132 +0xf0
net/http.(*persistConn).readLoop(0xc2082b5b80)
    /usr/src/go/src/net/http/transport.go:842 +0xa4
created by net/http.(*Transport).dialConn
    /usr/src/go/src/net/http/transport.go:660 +0xc9f

goroutine 5735 [IO wait]:
net.(*pollDesc).Wait(0xc2081e5170, 0x77, 0x0, 0x0)
    /usr/src/go/src/net/fd_poll_runtime.go:84 +0x47
net.(*pollDesc).WaitWrite(0xc2081e5170, 0x0, 0x0)
    /usr/src/go/src/net/fd_poll_runtime.go:93 +0x43
net.(*netFD).connect(0xc2081e5110, 0x0, 0x0, 0x7fc61e2db078, 0xc2081daea0, 0xecccaab9d, 0x12dde8a5, 0x83ce20, 0x0, 0x0)
    /usr/src/go/src/net/fd_unix.go:114 +0x24b
net.(*netFD).dial(0xc2081e5110, 0x7fc61e2db028, 0x0, 0x7fc61e2db028, 0xc208196a50, 0xecccaab9d, 0x12dde8a5, 0x83ce20, 0x0, 0x0)
    /usr/src/go/src/net/sock_posix.go:139 +0x37a
net.socket(0x6de250, 0x3, 0x2, 0x1, 0x0, 0xc208196a00, 0x7fc61e2db028, 0x0, 0x7fc61e2db028, 0xc208196a50, ...)
    /usr/src/go/src/net/sock_posix.go:91 +0x422
net.internetSocket(0x6de250, 0x3, 0x7fc61e2db028, 0x0, 0x7fc61e2db028, 0xc208196a50, 0xecccaab9d, 0x12dde8a5, 0x83ce20, 0x1, ...)
    /usr/src/go/src/net/ipsock_posix.go:137 +0x148
net.dialTCP(0x6de250, 0x3, 0x0, 0xc208196a50, 0xecccaab9d, 0x12dde8a5, 0x83ce20, 0xc2081f5a30, 0x0, 0x0)
    /usr/src/go/src/net/tcpsock_posix.go:156 +0x125
net.dialSingle(0x6de250, 0x3, 0xc2081f5850, 0x10, 0x0, 0x0, 0x7fc61e2daf98, 0xc208196a50, 0xecccaab9d, 0x12dde8a5, ...)
    /usr/src/go/src/net/dial.go:235 +0x3f5
net.func·016(0xecccaab9d, 0xe12dde8a5, 0x83ce20, 0x0, 0x0, 0x0, 0x0)
    /usr/src/go/src/net/dial.go:163 +0x12c
net.dial(0x6de250, 0x3, 0x7fc61e2daf98, 0xc208196a50, 0xc2080e7b08, 0xecccaab9d, 0xe12dde8a5, 0x83ce20, 0x0, 0x0, ...)
    /usr/src/go/src/net/fd_unix.go:40 +0x6f
net.(*Dialer).Dial(0xc20802e100, 0x6de250, 0x3, 0xc2081f5850, 0x10, 0x0, 0x0, 0x0, 0x0)
    /usr/src/go/src/net/dial.go:170 +0x4be
net.*Dialer.Dial·fm(0x6de250, 0x3, 0xc2081f5850, 0x10, 0x0, 0x0, 0x0, 0x0)
    /usr/src/go/src/net/http/transport.go:38 +0x79
net/http.(*Transport).dial(0xc208042000, 0x6de250, 0x3, 0xc2081f5850, 0x10, 0x0, 0x0, 0x0, 0x0)
    /usr/src/go/src/net/http/transport.go:479 +0x84
net/http.(*Transport).dialConn(0xc208042000, 0x0, 0xc20803aba0, 0x4, 0xc2081f5850, 0x10, 0x14ce5811154, 0x0, 0x0)
    /usr/src/go/src/net/http/transport.go:564 +0x1678
net/http.func·019()
    /usr/src/go/src/net/http/transport.go:520 +0x42
created by net/http.(*Transport).getConn
    /usr/src/go/src/net/http/transport.go:522 +0x335

Does it mean anything to you?

My configuration contains around 7 endpoints to check so maybe that doesn't help (Maybe I should have more than one instance of the monitor I mean)

Thanks,

Aurélien

Be able to configure the frequency of checks

Currently cachet-monitor seems to check the configured URLs every seconds.
In some scenario it would probably be ok to do that only every few minutes.

It would be nice to be able to configure the frequency either in the config file, either by ENV variable.

However, it works just fine like that so it would just be a nice to have.

Invalid Character '}' in config file?

I have been trying to get the new version of cachet-monitor up and running but I am running into an issue that I can't find the answer to...

When I run the process I get the following error:
image

Here is my entire config file but I am not seeing the extra '}'. Any one have an idea?

{
  "api": {
    "url": "MyCachet URL",
    "token": "MyToken",
    "insecure": false
	},
  "date_format": "02/01/2006 15:04:05 PST",
  "monitors": [
    {
      "name": "Site#1",
      "target": "Site1-Target",
      "strict": true,
      "method": "POST",
      "component_id": 1,
      "interval": 10,
      "timeout": 5,
      "threshold": 80,
      "expected_status_code": 200,
    },
	{
      "name": "Site#2",
      "target": "Site2-Target",
      "strict": true,
      "method": "POST",
      "component_id": 2,
      "interval": 10,
      "timeout": 5,
      "threshold": 80,
      "expected_status_code": 200,
    },
	{
      "name": "Site#3",
      "target": "Site3-Target",
      "strict": true,
      "method": "POST",
      "component_id": 4,
      "interval": 10,
      "timeout": 5,
      "threshold": 80,
      "expected_status_code": 200,
    },
	{
      "name": "Site#4",
      "target": "Site4-Target",
      "strict": true,
      "method": "POST",
      "component_id": 8,
      "interval": 10,
      "timeout": 5,
      "threshold": 80,
      "expected_status_code": 200,
    },
	{
      "name": "Site#5",
      "target": "Site5-Target",
      "strict": true,
      "method": "POST",
      "component_id": 9,
      "interval": 10,
      "timeout": 5,
      "threshold": 80,
      "expected_status_code": 200,
    }
  ]
}

100% CPU when viewing graph

Single metrics, only 3 components. As soon as I enable the metrics graph via cachet-monitor the CPU hits 100% for every page view for a good 60 seconds. If I disable the single metrics there is never any real load on the server rendering the page.

Am I doing something wrong?

Config:

{
  "api_url": "http://xx.xx.com/api/v1",
  "api_token": "xxx",
  "interval": 5,
  "monitors": [
    {
      "name": "xx Website",
      "url": "https://xx.com/apply",
      "metric_id": 2,
      "threshold": 80,
      "component_id": 1,
      "expected_status_code": 200,
      "strict_tls": true
    }
  ],
  "insecure_api": false
}

Change incident messages

Is it possible to edit the automated incident messages? I know they are editable in incident.go. Also is it possible to add a message if the incident is resolved?

API response time

Hey, guys, @matejkramny

I've just installed cachet-monitor and check the response time of my api.
It says, 203.93ms, but when I ping the api url in console, it only takes 20ms,

Is this something like a bug?

Incident reporting

Some of it is already in #master.

  • Download most recent incident (lookup by component id)
  • Submit new incident if monitor is failing (over threshold)
  • Resolve incidents after monitor falls below threshold

Could not log data point!

Hi,

I've just installed CachetHQ and your plugin, and it works well but I'm still getting this message :

2015/06/04 14:29:31 /home/ubuntu/.gvm/pkgsets/go1.4.2/global/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:68: https://api.mydomain.com/ping 0.00% Down at 1433420971. Threshold: 80.00%
2015/06/04 14:29:31 /home/ubuntu/.gvm/pkgsets/go1.4.2/global/src/github.com/castawaylabs/cachet-monitor/cachet/metrics.go:20: Could not log data point!
<nil>

When I look at the CachetHQ documentation and you request, POST /metrics/{id}/points does not exists (GET and DELETE only). Did I need to use a specific version of CachetHQ with your plugin ?

Cachet-Monitor as a Windows Service?

I have cachet-monitor running on a windows server box and was wondering if someone has any idea on how to have cachet-monitor run as a windows service? Anyone else install it in a windows environment?

Server ID

  • Generate a unique server (based on ip/hostname?)
  • Attach server id to incidents

can't load package: package github.com/castawaylabs/cachet-monitor

Ok total GO Noob here.

I'm on upstream debian jessie and install golang.

Issuing go install github.com/castawaylabs/cachet-monitor returns:

can't load package: package github.com/castawaylabs/cachet-monitor: cannot find package "github.com/castawaylabs/cachet-monitor" in any of:
        /usr/lib/go/src/pkg/github.com/castawaylabs/cachet-monitor (from $GOROOT)
        ($GOPATH not set)

I've cloned the repo:

  • run it inside it, same effect.
  • run it outside it, pointing to it's path, same effect.
  • moved the repo to /usr/lib/go/src/pkg/github.com/castawaylabs/cachet-monitor, different error but yet error

What's the gist about this?

Cannot create incident or metric

I am getting errors when I am trying to do a URL check ..
Here is my config file

{
  "api_url": "http://10.82.91.107/api/v1",
  "api_token": "7lipnzcreXL2eXQTYS9a",
  "monitors": [
    {
      "name": "Some Jenkins Master",
      "url": "http://myserver.mydomain.com/jenkinss/",
      "metric_id": 1,
      "component_id": 4,
      "threshold": 80,
      "expected_status_code": 200
    }
  ]
}
2015/06/24 21:43:37 /usr/local/go/bin/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:77: Creating incident...
2015/06/24 21:43:37 /usr/local/go/bin/src/github.com/castawaylabs/cachet-monitor/cachet/incident.go:42: Cannot parse incidents: json: cannot unmarshal string into Go value of type int
2015/06/24 21:43:37 /usr/local/go/bin/src/github.com/castawaylabs/cachet-monitor/cachet/incident.go:69: 400 {"errors":[{"status":400,"title":"Bad Request","detail":"The request cannot be fulfilled due to bad syntax."}]}
2015/06/24 21:43:37 /usr/local/go/bin/src/github.com/castawaylabs/cachet-monitor/cachet/incident.go:82: Could not create/update incident!
2015/06/24 21:43:38 /usr/local/go/bin/src/github.com/castawaylabs/cachet-monitor/cachet/incident.go:109: Cannot parse component body.
panic: json: cannot unmarshal string into Go value of type int

goroutine 52 [running]:
github.com/castawaylabs/cachet-monitor/cachet.(*Incident).fetchComponent(0xc2080a2960, 0x0, 0x0)
    /usr/local/go/bin/src/github.com/castawaylabs/cachet-monitor/cachet/incident.go:110 +0x2de
github.com/castawaylabs/cachet-monitor/cachet.(*Incident).UpdateComponent(0xc2080a2960)
    /usr/local/go/bin/src/github.com/castawaylabs/cachet-monitor/cachet/incident.go:125 +0x66
github.com/castawaylabs/cachet-monitor/cachet.(*Monitor).AnalyseData(0xc208010230)
    /usr/local/go/bin/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:97 +0x8f1
github.com/castawaylabs/cachet-monitor/cachet.(*Monitor).Run(0xc208010230)
    /usr/local/go/bin/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:34 +0x1e0
created by main.main
    /usr/local/go/bin/src/github.com/castawaylabs/cachet-monitor/main.go:26 +0x671

goroutine 1 [chan receive]:
main.main()
    /usr/local/go/bin/src/github.com/castawaylabs/cachet-monitor/main.go:24 +0x601

goroutine 61 [runnable]:
net/http.(*persistConn).readLoop(0xc2080662c0)
    /usr/local/go/src/net/http/transport.go:928 +0x9ce
created by net/http.(*Transport).dialConn
    /usr/local/go/src/net/http/transport.go:660 +0xc9f

goroutine 62 [select]:
net/http.(*persistConn).writeLoop(0xc2080662c0)
    /usr/local/go/src/net/http/transport.go:945 +0x41d
created by net/http.(*Transport).dialConn
    /usr/local/go/src/net/http/transport.go:661 +0xcbc

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:2232 +0x1

down threshold

how can I set the unhealthy threshold to three before creating incident?

do i run multiple instances of cachet-monitor for each target sys

Being new to Linux and go this might seem like a moronic question. My question is if I want to monitor the health of 10 systems - do I run a separate instance of cachet-monitor for each system in a cron job? Also, would anyone be willing to share some insight on what metrics they track and how? Trying to learn a little best practice as I move along. My implementation is very simple and is for an internal farm of systems (10 or you may have guessed that already) and I just need a simple status page. Cachet seems to fit the bill and this little gem seems to be part of the answer. Just having a tough time making heads or tails of all of the info on the web that always seems to be off just a smidge... Any ways - back to the question: a separate instance for each component/metric?

Monitoring some other services?

Hey!
Thanks for your great work!
Is it possible to add features like monitoring DBs like MySQL or MongoDB or check portbased websites?

Cachet-monitor installation is not working on Linux system.

Hey, guys.

I am trying to install cachet-monitor on linux system, but it doesn't work.
It says: "cachet-monitor: command not found"

I've tried all the ways mentioned in the closed issues, but nothing helped me.

  1. curl -L <download-link> > /usr/local/bin/cachet-monitor
    cachet-monitor -c ....
    This is not working. What do you mean download-link here?
    I tried in this way.
    curl -L github.com/CastawayLabs/cachet-monitor > /usr/local/bin/cachet-monitor
    And run cachet-monitor. It says:
/usr/local/bin/cachet-monitor: line 5: syntax error near unexpected token `newline'
/usr/local/bin/cachet-monitor: line 5: `<!DOCTYPE html>'
  1. go get -d github.com/castawaylabs/cachet-monitor
    go install github.com/castawaylabs/cachet-monitor
    Still not finding the cachet-monitor
  2. Tried with cachet-monitor_linux_amd64 but it says like this:
    invalid character '/' looking for beginning of object key string
panic: Cannot parse config!

goroutine 1 [running]:
panic(0x75c2e0, 0xc82000af50)
	/usr/local/Cellar/go/1.6/libexec/src/runtime/panic.go:464 +0x3e6
main.main()
	/Users/m/p/gospace/src/github.com/castawaylabs/cachet-monitor/cli/main.go:31 +0x16a

Can you guys please let me know the way to install on linux system?
@matejkramny can you please help me? :)
@moodhairboy can you check my post?

Adding basic access authentication

Is it doable to add support for websites using basic access authentication?. This is goint to be helpful for web services as well.
Bascially, we need to add username/password per monitored component:

{
 //other settings,
"username": "someone",
"password": "somepass"
}

incident Template

I finally have cachet-monitor running and I'm pretty sure it's working. at any rate - is anyone willing to share an incident template with me? I know nothing of the twig language so I am just stumped. I'd appreciate any help.

Plugin stops without error after multiple checks

Hello there,

I am running the cachet-monitor on a CoreOS cluster. I've setup the fleet unit file and config file. Everything is running smoothly except the monitor docker container appears to just stop running after 9 checks. No errors in any logs.

Docker logs

core@farm-3 ~ $ docker logs platform-monitor
2015/08/18 14:34:04 /go/src/github.com/castawaylabs/cachet-monitor/main.go:12: System: platform-monitor, API: https://technicstatus.pagefortress.com/api/v1
2015/08/18 14:34:04 /go/src/github.com/castawaylabs/cachet-monitor/main.go:13: Starting 1 monitors:
2015/08/18 14:34:04 /go/src/github.com/castawaylabs/cachet-monitor/main.go:15:  Technic Platform: GET http://www.technicpack.net & Expect HTTP 200
2015/08/18 14:34:04 /go/src/github.com/castawaylabs/cachet-monitor/main.go:17:  - Logs lag to metric id: 1
2015/08/18 14:34:04 /go/src/github.com/castawaylabs/cachet-monitor/main.go:21:
2015/08/18 14:34:05 /go/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: http://www.technicpack.net 0.00% Down at 1439908445. Threshold: 80.00%
2015/08/18 14:34:06 /go/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: http://www.technicpack.net 0.00% Down at 1439908446. Threshold: 80.00%
2015/08/18 14:34:07 /go/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: http://www.technicpack.net 0.00% Down at 1439908447. Threshold: 80.00%
2015/08/18 14:34:08 /go/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: http://www.technicpack.net 0.00% Down at 1439908448. Threshold: 80.00%
2015/08/18 14:34:09 /go/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: http://www.technicpack.net 0.00% Down at 1439908449. Threshold: 80.00%
2015/08/18 14:34:10 /go/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: http://www.technicpack.net 0.00% Down at 1439908450. Threshold: 80.00%
2015/08/18 14:34:11 /go/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: http://www.technicpack.net 0.00% Down at 1439908451. Threshold: 80.00%
2015/08/18 14:34:12 /go/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: http://www.technicpack.net 0.00% Down at 1439908452. Threshold: 80.00%
2015/08/18 14:34:13 /go/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: http://www.technicpack.net 0.00% Down at 1439908453. Threshold: 80.00%

Journal logs

Aug 18 14:34:00 farm-3 systemd[1]: Stopped Technic Platform monitor service for Cachet.
Aug 18 14:34:04 farm-3 systemd[1]: Starting Technic Platform monitor service for Cachet...
Aug 18 14:34:04 farm-3 docker[24066]: platform-monitor <-- killed
Aug 18 14:34:04 farm-3 docker[24074]: platform-monitor <-- removed
Aug 18 14:34:04 farm-3 systemd[1]: Started Technic Platform monitor service for Cachet.
Aug 18 14:34:04 farm-3 docker[24081]: 134f51c3542c545d0ae0bdd6badee21e300756b604a3ed1e46d75eb <-- run
Aug 18 14:34:14 farm-3 docker[24102]: platform-monitor <-- stopped unexpectedly

Monitor config.json

{
  "api_url": "https://technicstatus.pagefortress.com/api/v1",
  "api_token": "<redacted>",
  "monitors": [
    {
      "name": "Technic Platform",
      "url": "http://www.technicpack.net",
      "metric_id": 1,
      "component_id": 1,
      "threshold": 80,
      "expected_status_code": 200,
      "strict_tls": false
    }
   ],
   "insecure_api": true
}

unknown field ‘Timeout’ in ‘http.Client’

$GOROOT is set, GOPATH is set, yet when we "go install ..." we ge the following error:

cachet-monitor/cachet/monitor.go:47:3: error: unknown field ‘Timeout’ in ‘http.Client’
Timeout: timeout,
^

We're running Ubuntu 14.04.3 lts
and we've pulled the latest file of cachet.monitor

getsockopt: connection refused

How do I resolve the issue below:

2016/12/21 11:15:14 /Users/m/p/gospace/src/github.com/castawaylabs/cachet-monitor/incident.go:36: cannot fetch component: Get https://localhost/api/v1/components/2: dial tcp [::1]:443: getsockopt: connection refused
2016/12/21 11:15:14 /Users/m/p/gospace/src/github.com/castawaylabs/cachet-monitor/monitor.go:200: Error sending incident: Post https://localhost/api/v1/incidents: dial tcp [::1]:443: getsockopt: connection refused

I am running cachetHQ in a docker container on a mac and the cachet-monitor app outside the docker container.

getsockopt: connection refused

all,

I've managed to get cachet-monitor working, but when it attempts tp create incident I get the following errors"

2017/01/15 13:00:19 /Users/m/p/gospace/src/github.com/castawaylabs/cachet-monitor/incident.go:36: cannot fetch component: Get https://10.115.x.xxx/api/v1/components/12: dial tcp 10.115.4.102:443: getsockopt: connection refused
2017/01/15 13:00:19 /Users/m/p/gospace/src/github.com/castawaylabs/cachet-monitor/incident.go:36: cannot fetch component: Get https://10.115.x.xxx/api/v1/components/13: dial tcp 10.115.4.102:443: getsockopt: connection refused
2017/01/15 13:00:19 /Users/m/p/gospace/src/github.com/castawaylabs/cachet-monitor/monitor.go:200: Error sending incident: Post https://10.115.x.xxx/api/v1/incidents: dial tcp 10.115.4.102:443: getsockopt: connection refused
2017/01/15 13:00:19 /Users/m/p/gospace/src/github.com/castawaylabs/cachet-monitor/monitor.go:200: Error sending incident: Post https://10.115.x.xxx/api/v1/incidents: dial tcp 10.115.4.102:443: getsockopt: connection refused

The monitor continues running and then when it tries to write an incident the same errors occur.

Searching google pulls up more confusion than clarity - is this a port access issue on the server running cachet?

Could not log data point!

{
  "api_url": "http://status.file.test.com/api/v1/",
  "api_token": "rasdasdas",
  "monitors": [
    {
      "name": "API Servers Uptime",
      "url": "https://www.google.com/",
      "metric_id": null,
      "threshold": 80,
      "component_id": null,
      "expected_status_code": 200,
      "strict_tls": false
    }
  ],
  "insecure_api": true
}

These are the output

2016/02/13 21:28:38 /root/work/src/github.com/castawaylabs/cachet-monitor/main.go:13: Starting 1 monitors:
2016/02/13 21:28:38 /root/work/src/github.com/castawaylabs/cachet-monitor/main.go:15: API Servers Uptime: GET https://www.google.com & Expect HTTP 200
2016/02/13 21:28:38 /root/work/src/github.com/castawaylabs/cachet-monitor/main.go:21:
2016/02/13 21:28:39 /root/work/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: https://www.google.com 0.00% Down at 1455379119. Threshold: 80.00%
2016/02/13 21:28:40 /root/work/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: https://www.google.com 0.00% Down at 1455379120. Threshold: 80.00%
2016/02/13 21:28:41 /root/work/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: https://www.google.com 0.00% Down at 1455379121. Threshold: 80.00%
2016/02/13 21:28:42 /root/work/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: https://www.google.com 0.00% Down at 1455379122. Threshold: 80.00%
2016/02/13 21:28:43 /root/work/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: https://www.google.com 0.00% Down at 1455379123. Threshold: 80.00%
2016/02/13 21:28:44 /root/work/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: https://www.google.com 0.00% Down at 1455379124. Threshold: 80.00%
2016/02/13 21:28:45 /root/work/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: https://www.google.com 0.00% Down at 1455379125. Threshold: 80.00%
2016/02/13 21:28:46 /root/work/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: https://www.google.com 0.00% Down at 1455379126. Threshold: 80.00%
2016/02/13 21:28:47 /root/work/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: https://www.google.com 0.00% Down at 1455379127. Threshold: 80.00%
2016/02/13 21:28:48 /root/work/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: https://www.google.com 0.00% Down at 1455379128. Threshold: 80.00%
2016/02/13 21:28:49 /root/work/src/github.com/castawaylabs/cachet-monitor/cachet/monitor.go:84: https://www.google.com 0.00% Down at 1455379129. Threshold: 80.00%

AS per Your recommendation i checked with wireshark these are the reply

HTTP 167 CONNECT www.google.co.in:443 HTTP/1.1
HTTP 181 HTTP/1.1 200 Connection established
TCP 66 52309 > http-alt [ACK] Seq=102 Ack=116
TCP 66 52309 > http-alt [ACK] Seq=255 Ack=2852
TCP 66 52309 > http-alt [ACK] Seq=255 Ack=4325
TCP 66 http-alt > 52309 [ACK] Seq=4325 Ack=336
TCP 66 52309 > http-alt [ACK] Seq=576 Ack=5756
TCP 66 52309 > http-alt [ACK] Seq=576 Ack=8308
TCP 66 52309 > http-alt [ACK] Seq=576 Ack=11044
TCP 66 52309 > http-alt [RST, ACK] Seq=607
TCP 54 52309 > http-alt [RST] Seq=576 Win=0
TCP 54 52309 > http-alt [RST] Seq=576 Win=0
HTTP 190 Continuation or non-HTTP traffic
HTTP 726 Continuation or non-HTTP traffic
TCP 66 52074 > http-alt [ACK] Seq=621 Ack=3301
TCP 74 52310 > http-alt [SYN] Seq=0 Win=14600
TCP 74 http-alt > 52310 [SYN, ACK] Seq=0
TCP 66 52310 > http-alt [ACK] Seq=1 Ack=1
HTTP 167 CONNECT www.google.co.in:443 HTTP/1.1
HTTP 181 HTTP/1.1 200 Connection established
TCP 66 52310 > http-alt [ACK] Seq=102 Ack=116
TCP 66 52310 > http-alt [ACK] Seq=255 Ack=2852
TCP 66 52310 > http-alt [ACK] Seq=255 Ack=4325

What I am doing Wrong Here can you please Help

But Still i am not able to see the data written in dashboard ???

Quick question about the timeout config...

Here's my current config:

`{
  "api_url": "http://status.mysite.com/api/v1",
  "api_token": "xxxxx",
  "insecure_api": true,
  "monitors": [
    {
      "name": "mysite",
      "url":  "http://mysite.com/ping",
      "threshold": 80,
      "component_id": 3,
      "metric_id": 4,
      "interval": 30,
      "timeout": 25,
      "expected_status_code": 200
    }
  ]
}

If I set "timeout": 60, instead of 25. Will that overlap (interval is 30) cause issues with monitor? Will it wait for that check to timeout until next check or will the interval of 30 reset?

For my timeout I would like 60 seconds but when I set interval to 120 and set cacht's:
"How many minutes of threshold between metric point?" to 5

The graph still shows 1 min intervals. The metric never obey the minute setting of 300 seconds.

So Hoping to use 30 second interval and longer timeout.

Possible?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.