Giter Site home page Giter Site logo

keepalive-service's Introduction

Keepalive Service

A tool to monitor servers and keep 'em alive by periodically pinging them. This tool is useful for monitoring servers like repl.it projects and also has notifications built-in. Discord webhooks currently supported.

Setup

Currently, there are two ways to setup and run keepalive-service:

  1. Clone, setup, and run this repo directly
  2. Use the prebuilt docker container

The following sections describe how to use both approaches.

Direct Installation

Clone the repo:

git clone https://github.com/madhavarshney/keepalive-service
cd keepalive-service

Install Python 3 and pip, and then install the required packages:

python3 -m pip install -r requirements.txt

Create a file called config.yaml with your configuration (see below) and then start the monitoring script:

python3 -m keepalive

Using Docker

This service can also be run as a docker container. Prebuilt images are available at ghcr.io/madhavarshney/keepalive-service. The config file should be bind-mounted as a volume to /keepalive-service/config.yaml, and --init should be enabled.

Running with Docker:

docker run --init \
  -v "$(pwd)"/config.yaml:/keepalive-service/config.yaml \
  ghcr.io/madhavarshney/keepalive-service:latest

Using Docker Compose:

version: "3.9"

services:
  keepalive:
    image: ghcr.io/madhavarshney/keepalive-service:latest

    restart: always
    init: true

    volumes:
      - ./config.yaml:/keepalive-service/config.yaml:ro

Configuration

The configuration file config.yaml should follow the following format:

# Time in seconds to recheck the services
interval: 60

# Discord Webhook URL to send notifications to
discord_webhook_url: https://discordapp.com/api/webhooks/...

# Service definitions
services:
  - name: Repl.it HTTP Project
    check:
      # Check a generic HTTP service hosted on repl.it
      # This fetches the specified URL and verifies that the returned content matches "data".
      type: REPL_HTTP_SERVICE
      url: https://coolnewthing.someone.repl.co
      data: Service is working.

  - name: My Webpage
    check:
      # Check a generic webpage with HTML content.
      # This verifies that the HTML <title> element matches "data".
      type: HTML_TITLE
      url: https://webpage.someone.repl.co
      data: The Daily News

License

The MIT License.

keepalive-service's People

Contributors

madhavarshney avatar

Watchers

James Cloos avatar  avatar

Forkers

frenchlessons75

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.