Giter Club home page Giter Club logo

provence's Introduction

provence

A simple and minimalistic monitoring solution for any and all systems

It executes bash scripts on a cron-based interval, saves the output into a database and alerts based on the return code.

WARNING: This is supposed to be an internal service!
It has neither user management nor any security checks in the bash scripts it executes.
In short: With this you could easily get linux user access!
Please be careful.

Requirements

  • A mariadb / mysql database, no other db is supported yet

Install

Simply use go build . to make the executable. The html templates and web resources will be embedded in the executable.

Rename the config and edit it

cp config.example.yaml config.yaml
vim config.yaml

To start it use

./provence >> prov.log

The only 2 files required to start the application are the executable and the config.yaml.

Because of gin's Recovery usage and my added recovery call in gocron's functions the application should never crash.
It is running since months on my debian server without any crashes.

Usage

First create a notifygroup.
This is the configuration of whom to alert and how to alert them.
Webhooks were tested with Discord and MS teams.

Then create a cronjob.
They get grouped by their group on the homepage.
The "failsneeded" field sets how many failed executions of a cronjob are needed for it to trigger as a failure.
The "always notify" checkbox makes every execution, even successful ones, trigger a notification.

NGINX config

This service doesn't need any special nginx configuration.
Example config that works:

location /monitor/ {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_pass http://localhost:7070/;
}

Example bash scripts

Check disk usage on remote server via ssh

This will connect to a remote server and check if the disk usage of "sda" is over 95%. If yes then it will exit 1, else 0.

FSIZE=$(ssh [email protected] df -h . | grep sda | awk '{print $5}' | grep -Eo "[0-9][0-9]")
exit $(( $( echo $FSIZE | tr '\r' ' ') > 95 ))

SSL certificate expiry check

This will check if the http certificate expiry of e.g. example.com will be in less than 28days.

echo | openssl s_client -servername example.com -connect example.com:443 2>/dev/null | openssl x509 -noout -checkend 2419200

Verify if host is reachable

This also outputs info about connect-time, time-till-first-byte and total time needed.

curl -s -w 'Establish Connection: %{time_connect}s\nTTFB: %{time_starttransfer}s\nTotal: %{time_total}s\n' -I https://example.com/

provence's People

Contributors

overlordakise avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.