Giter Site home page Giter Site logo

adhityaramadhanus / gopatrol Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 0.0 6.97 MB

self-hosted endpoint monitoring daemon with centralized events log using MongoDB based on https://github.com/sourcegraph/checkup

License: MIT License

Makefile 1.40% Go 98.60%
checkup golang monitoring statuspage grpc

gopatrol's Introduction

gopatrol

Go Report Card Build Status

self-hosted endpoint monitoring daemon with centralized events log using MongoDB based on https://github.com/sourcegraph/checkup

Installation | Setting API Server | Setting Daemon | CLI | CLI | Slack Notifier | Email Notifier | License

gopatrol is self-hosted health checks, written in Go using checkup (instead of using them as dependency i decide to copy the file to this project) and restful api to interact with.

There is much work to do for this project to be complete. Use it carefully.

gopatrol currently supports:

  • Checking HTTP endpoints
  • Checking TCP endpoints (TLS supported)
  • Checking of DNS services & record existence
  • Storing events in MongoDB
  • Add delete update checkers with dashboard/cli
  • Easy to setup and deploy
  • Get notified via slack and email (need help with email notifier)

Installation

  • git clone
  • make
NAME:
   gopatrol-cli - gopatrol cli 

USAGE:
   gopatrol-cli [global options] command [command options] [arguments...]

VERSION:
   1.0.0

AUTHOR:
   Adhitya Ramadhanus <[email protected]>

COMMANDS:
     add-http  Add endpoints to checkup
     add-tcp   Add tcp endpoints to checkup
     add-dns   Add dns endpoints to checkup
     list      list endpoint
     delete    delete endpoint
     help, h   Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h     show help
   --version, -v  print the version
NAME:
   gopatrol - gopatrol daemon 

USAGE:
   gopatrol [global options] command [command options] [arguments...]

VERSION:
   1.0.0

AUTHOR:
   Adhitya Ramadhanus <[email protected]>

COMMANDS:
     daemon   run gopatrol checking daemon
     api      run gopatrol api server
     help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h     show help
   --version, -v  print the version

Setting up gopatrol API Server

There's 2 different setup configuration for cli and dashboard, you can interact with the api using cli only if you run the api in unix domain socket

For these two setup you also need to set env var, i suggest using .env file to store your config

Example of .env

MONGODB_URI="mongodb://localhost:27017/gopatrol"
JWT_SECRET="Something"
ENV="Development"
  1. Setup For CLI
$ gopatrol api --log=<log output, stdout, stderr or filename> --proto=unix

it will run on a socket file /tmp/gopatrol.sock

  1. Setup For Dashboard
$ gopatrol api --log=<log output, stdout, stderr or filename> --proto=http --address=:3000

it will run on port 3000

Setting up gopatrol daemon

You also need to set env var for daemon to work mostly for mongodb and slack notifier, i suggest using .env file to store your config

Example of .env

MONGODB_URI="mongodb://localhost:27017/gopatrol"
SLACK_TOKEN="xoxb-something-something" //bot users token
SLACK_CHANNEL="something" // channel ID 
ENV="Development"
$ gopatrol daemon --log=<log output, stdout, stderr or filename> interval (10s, 1m, etc)

Interacting with API using CLI

  1. Adding Tcp endpoint
NAME:
   gopatrol-cli add-tcp - Add tcp endpoints to checkup

USAGE:
   gopatrol-cli add-tcp [command options] name url

OPTIONS:
   --attempts value, -a value         how many times to check endpoint (default: 5)
   --thresholdrtt value, --rtt value  Threshold Rtt to define a degraded endpoint (default: 0)
   --tls-enabled                      Enable TLS connection to endpoint
   --tls-ca value                     Certificate file to established tls connection
   --tls-skip-verify                  Skip verify tls certificate
   --timeout value                    Timeout to established a tls connection (default: 3000000000)
  1. Adding Http endpoint
NAME:
   gopatrol-cli add-http - Add endpoints to checkup

USAGE:
   gopatrol-cli add-http [command options] name url

OPTIONS:
   --attempts value, -a value         how many times to check endpoint (default: 5)
   --thresholdrtt value, --rtt value  Threshold Rtt to define a degraded endpoint (default: 0)
   --mustcontain value                HTML content that a page should contain to determine whether a page is up or down
   --mustnotcontain value             HTML content that a page should not contain to determine whether a page is up or down
   --headers value                    Http Headers to send along the check request
   --upstatus value                   Http status code to define a healthy page (default: 200)
  1. Adding DNS endpoint
NAME:
   gopatrol-cli add-dns - Add dns endpoints to checkup

USAGE:
   gopatrol-cli add-dns [command options] name url hostname

OPTIONS:
   --tls                              Send request over tls
   --host value                       grpc server address (default: "/tmp/gopatrol.sock")
   --attempts value, -a value         how many times to check endpoint (default: 5)
   --thresholdrtt value, --rtt value  Threshold Rtt to define a degraded endpoint (default: 0)
   --timeout value                    Timeout to established a tls connection (default: 3000000000)
  1. Deleting Endpoint
NAME:
   gopatrol-cli delete - delete endpoint

USAGE:
   gopatrol-cli delete [command options] slug
  1. Listing Endpoint
NAME:
   gopatrol-cli list - list endpoint

USAGE:
   gopatrol-cli list [command options] [arguments...]

Interacting with API using Dashboard

Still in progress

dashboard

Notifier (Slack)

  • To use this notifier you need bot integration in your team and channel id where this bot will notify you, refer to this link https://api.slack.com/bot-users
  • After you get the tokens and channel ID, set it in env var ot use .env file

slack-notifier

Notifier (Email)

  • NIP, not in progress, but definitely in to-do list

License

MIT © [Adhitya Ramadhanus]

gopatrol's People

Contributors

adhityaramadhanus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gopatrol's Issues

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.