GithubHelp home page GithubHelp logo

admonstrator / glinet.status Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cyclenerd/static_status

0.0 0.0 0.0 426 KB

Monitors the current status of GL.iNet services

Home Page: https://glinet-status.admon.in.ua/

License: GNU General Public License v3.0

Shell 100.00%

glinet.status's Introduction

status.sh ๐Ÿš€

Badge: GNU Bash Badge: ShellCheck Badge: Ubuntu 22.04 LTS Badge: GitHub

Description ๐Ÿ“

Simple Bash script to generate a static status page. Displays the status of websites, services (HTTP, SAP, MySQL...), and ping. Everything is easy to customize. ๐Ÿค“

You can also easily check more complicated things with this script. For example, if a text is present on a web page or if a host appears in the route path (traceroute). Checking the route path is useful, for instance, if you have a backup mobile internet connection in addition to your cable connection.

Screenshot

In addition to the status web page, there is also a JSON version and an SVG icon. With the script alert.sh, you can be alerted by email, SMS or Pushover in case of a downtime.

Installation ๐Ÿ“ฆ

By default, it's a good practice to create a status directory within your home directory and place everything in it :

mkdir ~/status
cd ~/status

1๏ธโƒฃ Download Script

Download Bash script status.sh:

curl -O "https://raw.githubusercontent.com/Cyclenerd/static_status/master/status.sh"

๐Ÿ’ก Tip: Update works exactly the same way as the installation. Simply download the latest version of status.sh.

2๏ธโƒฃ Download Configuration

Download configuration file status_hostname_list.txt:

curl -O "https://raw.githubusercontent.com/Cyclenerd/static_status/master/status_hostname_list.txt"

3๏ธโƒฃ Customize

Customize the status_hostname_list.txt configuration file and define what you want to monitor:

vi status_hostname_list.txt

Optional

Edit the script status.sh, or better add more configuration to the configuration file config.

Download the example configuration file:

curl \
  -f "https://raw.githubusercontent.com/Cyclenerd/static_status/master/config-example" \
  -o "config"

Customize the configuration file:

vi config

Run

bash status.sh

Usage ๐Ÿ“‹

Usage: status.sh [OPTION]:
	OPTION is one of the following:
		 silent  no output from faulty connections to stout (default: no)
		 loud    output from successful and faulty connections to stout (default: no)
		 debug   displays all variables
		 help    displays help (this message)

Example:

bash status.sh loud

Execute a cron job every minute:

crontab -e

Add:

*/1 * * * * bash "/path/to/status.sh" silent >> /dev/null

Requirements โš™๏ธ

Only bash, ping, traceroute, curl, nc, grep and sed. In many *NIX distributions (Ubuntu, macOS) the commands are already included. If not, the missing packages can be installed quickly.

On a debian-based system (Ubuntu), just run:

sudo apt install curl iputils-ping traceroute netcat-openbsd grep sed

๐Ÿ’ก Tip: You can disable the traceroute dependency. Add MY_TRACEROUTE_HOST='' to your config.

Demo ๐ŸŒ

This demo page is generated with GitHub Action: https://cyclenerd.github.io/static_status/

Screenshots ๐Ÿ“ท

Screenshot Screenshot Screenshot Screenshot Screenshot

Custom Text ๐Ÿ“„

You can display a custom text instead of the HOSTNAME/IP/URL (see example below).

Screenshot

status_hostname_list.txt:

ping;8.8.8.8|Google DNS
nc;8.8.8.8|DNS @ Google;53
curl;http://www.heise.de/ping|www.heise.de
traceroute;192.168.211.1|DSL Internet;3
script;/bin/true|always up

JSON ๐Ÿ“Š

You can also create a JSON status page. Configure the variable MY_STATUS_JSON with the location where the JSON file should be stored.

Example JSON:

[
  {
    "site": "https://www.nkn-it.de/gibtesnicht",
    "command": "curl",
    "status": "Fail",
    "time_sec": "282",
    "updated": "2023-04-19 14:01:23 UTC"
  },
  {
    "site": "https://www.heise.de/ping",
    "command": "curl",
    "status": "OK",
    "time_sec": "0",
    "updated": "2023-04-19 14:01:23 UTC"
  }
]

SVG Icon ๐Ÿ–ผ๏ธ

If you want to signal directly if everything is fine or if something is wrong in the infrastructure, you can insert the SVG icon into your website.

Please remember to include the image with a cache breaker URL (eg. an appended timestamp:

<a href="status.html">Status <img src="status.svg?{{ timestamp }}"></a>

Static websites need to fallback to render the icon with javascript, eg with:

document.write('<img src="status.svg?' + Date.now() + '">')

Custom Script Checks ๐Ÿ› ๏ธ

You can extend the checks of status.sh with your own custom shell scripts.

If the shell script outputs a return code 0 it is evaluated as available. With the special return code 80, it is not classified as down but as degraded. With all other return codes, it is a failure (outage, down).

Add your script to the status_hostname_list.txt configuration file. Example:

script;script.sh
script;/path/to/your/script.sh|Custom Text
script;/path/to/your/script.sh parameterA parameterB|Custom Text

The script check-websites.sh is an example.

TODO โœ…

  1. Bug Fixes and Enhancements: Address any reported issues and consider adding new features to improve the script's functionality.

  2. Comprehensive Documentation: Create detailed documentation covering script configuration, customization, and advanced usage.

  3. Code Cleanup: Enhance code readability and performance for better maintainability.

  4. Security: Review and enhance security measures to protect against vulnerabilities.

License ๐Ÿ“œ

GNU Public License version 3. Please feel free to fork and modify this on GitHub (https://github.com/Cyclenerd/static_status).

glinet.status's People

Contributors

cyclenerd avatar admonstrator avatar acullmann avatar sengaya avatar ayan-joshi avatar chrisx8 avatar fbartels avatar wombelix avatar brknkfr avatar mbos avatar kevinpapst avatar flocke avatar outis151 avatar moppman avatar manavb2214 avatar greenknot avatar dependabot[bot] avatar vatsalya-vyas avatar shresthasurav avatar shivam250702 avatar mishrasamiksha avatar dmarto avatar kalyanimhala avatar janumalaakhilendra avatar himanshumahto avatar e-minguez avatar abhishek213-alb 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.