Giter Club home page Giter Club logo

statusok's Introduction

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",
			"from":"[email protected]",
			"to":"[email protected]"
		}
	},
	"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: Download bin file from here and run the below command from your terminal

$ ./statusok --config config.json

Thats it !!!! You will receive a mail when your website is down or response time is more.

To run as background process add & at the end

$ ./statusok --config 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.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 run -d -v /path/to/config/folder:/config sanathp/statusok

Note: Config folder should contain config file with name config.json

Running with Docker Compose

Prepare docker-compose.yml config like this:

version: '2'
services:
  statusok:
    build: sanathp/statusok
    volumes:
      - /path/to/config/folder:/config
    depends_on:
      - influxdb
  influxdb:
    image: tutum/influxdb:0.9
    environment:
      - PRE_CREATE_DB="statusok" 
    ports:
      - 8083:8083 
      - 8086:8086
  grafana:
    image: grafana/grafana
    ports:
      - 3000:3000

Now run it:

docker-compose up

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

statusok's People

Contributors

coldfire-x avatar damarte avatar daya0576 avatar floriancourgey avatar pierrebrisorgueil avatar rmeharg avatar sanathp avatar th0mc 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

statusok's Issues

Feature request: Possible integration with cachethq ?

Is possible to think about integration with statuspage software like cachethq, staytus, statuspage.io ,etc ...?
Of course Incidents can be handled with already available Webhooks, but for metrics, there should be a something like webhook backend to send received data to webhook, for example cachethq API metrics endpoind.
Thanks

Use environment variables

This program should support the use of variables in the config.json file.

Something like ${password} or {{password}} should be replaced with environment variables from the system that the daemon is running on.

PagerDuty Guide

Hi, I see PagerDuty has been integrated in the code. But don't see any guide on how to use it. Please give a short guide

influxdb ssl

It would be great if this could connect to influxdb via ssl and have the insecure_skip_verify options.

Cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal

We try to build source, I got this error:

$ go build
# ~/statusok
./statusok.go:40:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
	cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
./statusok.go:45:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in slice literal:
	cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
./statusok.go:52:13: cannot use func literal (type func(*cli.Context)) as type cli.ActionFunc in assignment

Allow entering multiple recipients for one form of notifications

Hi there, I would like to either configure multiple addresses like this:

"notifications":{
	"mail":{
		"smtpHost":"smtp.gmail.com",
		"port":587,
		"username":"[email protected]",
		"password":"your gmail password",
		"from":"[email protected]",
		"to":"[email protected]"
	},
	"mail":{
		"smtpHost":"smtp.gmail.com",
		"port":587,
		"username":"[email protected]",
		"password":"your gmail password",
		"from":"[email protected]",
		"to":"[email protected]"
	}
},

Or be able to use an array in the to field.

Also, while I'm bothering you with feature requests: a bcc would not hurt ;-)

Trigger different Notifications

I want to monitor a website and trigger a pager-duty 'non critical' when xxx response time is met, then when a higher response time is meet i want to trigger a critical pager duty notification.

i/o timeout

Hello,

when i set the statusOk program running, i get a lot off the following errors:
dial tcp <hostip>: i/o timeout & net/http: TLS handshake timeout

i have looked around and most of the results are about DNS and / or Networking but both seem to be fine..
do you have a tip for where to look to solve this error?

Geo-distributed monitoring

Is there a way to monitor a website from multiple locations so to compare response times for each client side-by-side?

Graphana Dashboard query

Hi,

I have installed statusok correctly,

But I am having hard time visualizing it in Graphana, can anyone share a template/graphana queries?
I just want to visualize my Get requests response time v/s date-time.
Just as shown in statusok's readme files sreenshot.

Thanks.

fail to notify ding

my config.json

    {
        "notifications":{
            "dingding":{
                "url": "https://oapi.dingtalk.com/robot/send?access_token=blablablablablalba",
                "requestType":"POST",
                "headers":{
                    "Content-Type":"application/json"
                }
            }
        },
        "requests":[
            {
                "url":"http://www.example.com",
                "requestType":"GET",
                "checkEvery":30,	
                "responseTime":800
            }
        ]
    }

Base on statusOK it did show success and error.. however no notification? Do I missing something?

looks cool, similar to blackbox exporter

This looks cool, similar, maybe even simplified version of https://github.com/prometheus/blackbox_exporter

I was wondering if there's room to share ideas between projects?

With BBE, you need Prometheus and AlertManager to actually get notifications. On one side, that's a fairly standard stack and the decoupling means extra flexibility. The downside is it lacks the extreme simplicity and "all in one" feel of this package.

Can you make a feature comparison?

How to ignore bad (self-signed) SSL certificate in requests

I tried to monitor a website with self-signed SSL certificate, but got error due to cert validation. Is there a way to skip cert validation?

by the way, I tried to set InsecureSkipVerify=true but that doesn't seem to work.

=========== error msg below =============

acheng@epcnszxw0150:~/Downloads/statusok_linux$ env InsecureSkipVerify=true ./statusok --config config.json
Reading File : config.json
No clients Registered for Notifications
Sending Test notifications to the registered clients
No Database selected.

Sending requests to apis.....making sure everything is right before we start monitoring
Api Count: 1
Request # 0 : GET https://ecsc001067.example.com:9002/

Failed !!!! Not able to perfome below request

----Request Deatails---
Url : https://ecsc001067.example.com:9002/
Type : GET
Error Reason : Get https://ecsc001067.example.com:9002/: x509: certificate is valid for hybris, not ecsc001067.example.com

Please check the config file and try again

ARM Version

Ist there a way, to get this run on an raspberry pi?

config.json requests not taken

Using docker based setup and this is how I have in my Macbook pro 2019 and all three docker services working ok.

config.json

{
	"notifications": {
		"slack":{
			"channel":"#general",
			"username":"my-slack-user-name",
			"channelWebhookURL":"https://hooks.slack.com/services/1235435/4543543/5435435"
		}
	},
	"requests": [
		{
			"url": "https://serviceofmine.me",
			"requestType": "GET",
			"headers": {
				"Authorization": "Bearer ac2168444f4de69c27d6384ea2ccf61a49669be5a2fb037ccc1f"
			},
			"urlParams": {
				"name": "statusok"
			},
			"checkEvery": 1,
			"responseCode": 300,
			"responseTime": 500
		}
	]
}

docker-compose.yml

version: '2'
services:
  statusok:
#    build: sanathp/statusok
    build: ..
    volumes:
      - .:/config
    depends_on:
      - influxdb
  influxdb:
    image: tutum/influxdb:0.9
    environment:
      - PRE_CREATE_DB="statusok"
    ports:
      - 8083:8083
      - 8086:8086
  grafana:
    image: grafana/grafana
    ports:
      - 3000:3000

Since not able to pull sanathp/statusok image I used available dockerfile.

This does posts message to slack channel but its always sending only test notification and not the actual service error notice.

I am missing some step, can you please point me in right direction

Mailgun Notification service is breaking the install/build

When trying to install/build there was an error with the MailGun notification service. After reviewing, it looks like the Mailgun service no longer requires a public key to be passed (just domain and private key). I put through a pull request that adheres to the new requirements of the Mailgun v2 API: #40

Response Parameter Inception

Can we mention any response parameter with it's expected value, to check if API is working as expected on a logical basis?

Sends emails with incorrect headers

Email notifications are sent with incorrect headers causing them to be blocked by most major email services (Google etc)

Can be fixed by adding a valid from and subject to email message

example:

550-5.7.1 [216.92.131.252      11] Our system has detected that this
message is 550-5.7.1 not RFC 5322 compliant: 550-5.7.1 'From' header is
missing. 550-5.7.1 To reduce the amount of spam sent to Gmail, this message
has been 550-5.7.1 blocked. Please visit 550-5.7.1
https://support.google.com/mail/?p=RfcMessageNonCompliant 550 5.7.1 and
review RFC 5322 specifications for more information. h20si4460693qvw.81 -
gsmtp (in reply to end of DATA command)

Refrain from logging to console

...makes for an awfully noisy process while still connected and working on a machine. It'd be great if there were a way to prevent any output from the script.

302 is ignored

Hi,

I'm trying to monitor pages on a site which is configured to redirect a resource is unavailable. I found that when presented with a 302 (object moved) response, statusok happily follows the redirect. This means statusok will miss the event when a page goes down.

While I'm not trying to monitor my old blog, it can be used to repro:

  1. Set up monitoring for http://little.org/thisIsNotARealPage.htm as type "GET" with expected response code of 200
  2. Set up monitoring for http://little.org/thisIsNotARealPage.htm as type "GET" with expected response code of 302

Result: statusok reports success for the first item and failure for the second.
Expected: status okay should report failure for the first and success for the second.

Thanks for the cool tool!

x509: certificate signed by unknown authority Erro when running inside docker

I am using the dockerfile provided in the repository,
with the following configuration
"mail": { "smtpHost": "smtp.gmail.com", "port": 587, "username": "[email protected]", "password": "XXXXX", "from": "[email protected]", "to": "[email protected]" }

when I run docker image I have this output

Reading File : /config/config.json
Initializing Notification Clients....
Notifications : Smtp Mail Intialized
Sending Test notifications to the registered clients
Failed to Send Response Time notification to Smtp Mail Please check the details entered in the config file
Error Details : x509: certificate signed by unknown authority

I tried to install ca-certicates and update the certifcates but I still have the same error

FROM golang:1.6.3

ENV STATUSOK_VERSION 0.1.1

RUN apt-get update \
    && apt-get install -y unzip  ca-certificates  \
    && wget https://github.com/sanathp/statusok/releases/download/$STATUSOK_VERSION/statusok_linux.zip \
    && unzip statusok_linux.zip \
    && mv ./statusok_linux/statusok /go/bin/StatusOk \
    && rm -rf ./statusok_linux* \
    && apt-get remove -y unzip git \
    && apt-get autoremove -y \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

ENV TZ=Europe/Berlin


RUN  update-ca-certificates -f ;

VOLUME /config
COPY ./docker-entrypoint.sh /docker-entrypoint.sh
ENTRYPOINT ["sh", "/docker-entrypoint.sh"]

server not website check

I see that you can POST, GET, and DELETE, requests. Is it possible to do ICMP pings, TCP pings, UDP pings for monitoring server response times, or a test to a connect to a port like port 22 that is running on each server?

I have issue with influxdb

It seems like influxdb+Grafana integration does not work. db connection is working.

config.json

{
"database":{
        "influxDb":{
            "host":"localhost",
            "port":8086,
            "databaseName":"statusok",
            "username":"",
            "password":""
        }
},
    "requests":[
        {
            "url":"https://camva.ir",
            "requestType":"GET",
            "checkEvery":30,
            "responseTime":800
        }
    ]
}

I checked the db. data is being logged.

no subject

Hi
emails have no any subject.
can i add any subject instead of empty subject?

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.