Skip to content

Monitor your Website and APIs from your Computer. Get Notified through Slack, E-mail when your server is down or response time is more than expected.

License

Notifications You must be signed in to change notification settings

1024kilobyte/statusok

 
 

Repository files navigation

NOTE:

This is a fork from sanathp/statusok, so all credit belongs there. If you have a moment please leave a star.

The purpose of this fork is to update the source to compile again and add some minor features as needed.

StatusOK

Monitor your Website and APIs from your computer. Get notified through Slack or E-mail when your server is down or response time is more than expected.

Simple Version

Simple Setup to monitor your website and recieve a notification to your Gmail when your website is down.

Step 1: Write a config.json with the url information

{
	"notifications":{
		"mail":{
			"smtpHost":"smtp.gmail.com",
			"port":587,
			"username":"[email protected]",
			"password":"your gmail password",
			"senderName":"the sender name showed in email clients",
			"from":"[email protected]",
			"receiverName":"the receiver name showed in email clients",
			"to":"[email protected]",
			"subject":"your mail subject"
		}
	},
	"requests":[
		{
			"url":"http://mywebsite.com",
			"requestType":"GET",
			"checkEvery":30,	
			"responseTime":800
		}
	]
}

Turn on access for your gmail https://www.google.com/settings/security/lesssecureapps .

Step 2: build the project using the following command (go needs to be installed on your system, see instructions here)

$ go build

Step 3: run statusok

$ ./statusok --config ./config/statusok/config.json

Step 4: there is no step 4, you will receive a mail when your website is down or response time is too high.

To run as background process add & at the end

$ ./statusok --config ./config/statusok/config.json &	

to stop the process

$ jobs
$ kill %jobnumber

Complete Version using InfluxDb

alt text

You can save data to influx db and view response times over a period of time as above using graphana.

Guide to install influxdb and grafana

With StatusOk you can monitor all your REST APIs by adding api details to config file as below.A Notification will be triggered when you api is down or response time is more than expected.

{
	"url":"http://mywebsite.com/v1/data",
	"requestType":"POST",
	"headers":{
		"Authorization":"Bearer ac2168444f4de69c27d6384ea2ccf61a49669be5a2fb037ccc1f",
		"Content-Type":"application/json"
	},
	"formParams":{
		"description":"sanath test",
		"url":"http://google.com"
	},
	"checkEvery":30,
	"responseCode":200,		
	"responseTime":800
},

{
	"url":"http://mywebsite.com/v1/data",
	"requestType":"GET",
	"headers":{
		"Authorization":"Bearer ac2168444f4de69c27d6384ea2ccf61a49669be5a2fb037ccc1f",		
	},
	"urlParams":{
		"name":"statusok"
	},
	"checkEvery":300,
	"responseCode":200,		
	"responseTime":800
},

{
	"url":"http://something.com/v1/data",
	"requestType":"DELETE",
	"formParams":{
		"name":"statusok"
	},
	"checkEvery":300,
	"responseCode":200,		
	"responseTime":800
}

Guide to write config.json file

Sample config.json file

To run the app

$ ./statusok --config ./config/statusok/config.json &

Database

Save Requests response time information and error information to your database by adding database details to config file. Currently only Influxdb 0.9.3+ is supported.

You can also add data to your own database.view details

Notifications

Notifications will be triggered when mean response time is below given response time for a request or when an error is occured . Currently the below clients are supported to receive notifications.For more information on setup click here

  1. Slack
  2. Smtp Email
  3. Mailgun
  4. Http EndPoint
  5. Dingding

Adding support to other clients is simple.view details

Running with plain Docker

docker image build -t statusok .

docker container run -v ./config/statusok/config.json:/config statusok

Note: config/statusok folder should contain config file with name config.json

Running with Docker Compose

An predefined compose file is in the root directory of the project. The file builds the statusok project from the local Dockerfile and also creates and starts an influxdb and grafana instance.

Now run it:

docker-compose up -d

You can now login to grafana and configure dashboards (url: http://localhost:3000, default username "admin", default password "admmin").

Contribution

Contributions are welcomed and greatly appreciated. Create an issue if you find bugs. Send a pull request if you have written a new feature or fixed an issue .Please make sure to write test cases.

License

Copyright 2015 Sanath Kumar Pasumarthy

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License

About

Monitor your Website and APIs from your Computer. Get Notified through Slack, E-mail when your server is down or response time is more than expected.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 98.9%
  • Other 1.1%