• Stars
    star
    513
  • Rank 83,153 (Top 2 %)
  • Language
    Shell
  • License
    GNU General Publi...
  • Created over 7 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🚦Bash script to generate a static status page.

status.sh

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

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

You can also easily check more complicated things with this script. For example if a text is present in 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 is best to place everything in your home directory in a new status directory:

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 example configuration file:

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

Customize 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)
		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 varaible 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 websites.

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 needs 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 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

TODO

  • More and better documentation

Help is welcome πŸ‘

License

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

More Repositories

1

ethereum_nvidia_miner

πŸ’° USB flash drive ISO image for Ethereum, Zcash and Monero mining with NVIDIA graphics cards and Ubuntu GNU/Linux (headless)
Shell
846
star
2

gallery_shell

πŸ“· Bash Script to generate static responsive image web galleries.
Shell
239
star
3

postinstall

πŸ’» Bash Script to automate post-installation steps
Shell
148
star
4

google-cloud-compute-machine-types

☁️ Choose the optimal Google Compute Engine machine type or instance in the many Google Cloud Platform regions
Perl
146
star
5

google-cloud-pricing-cost-calculator

πŸ’Έ Calculate estimated monthly costs of Google Cloud Platform products and resources via YAML files and CLI program (Linux, macOS, Windows)
Go
118
star
6

google-cloud-gcp-openai-api

🌴 Drop-in replacement REST API for Vertex AI (PaLM 2, Codey, Gemini) that is compatible with the OpenAI API specifications
Jupyter Notebook
55
star
7

benchmark

πŸ‹οΈ Bash Script which runs several Linux benchmarks (Sysbench, UnixBench and Geekbench)
Shell
52
star
8

poweroff-google-cloud-cap-billing

πŸ“΄ Automating cost control by capping Google Cloud billing
HCL
33
star
9

Latrine

πŸ“‘ Locus Map GPS Live Tracking Server Script
HTML
13
star
10

google-cloud-shell-vscode

β›… Run OpenVSCode Server in Google Cloud Shell
Shell
12
star
11

google-cloud-server-on-demand

▢️ Server on Demand Appliance (Google Compute Engine) - Cloud Build with Terraform and Ansible Showcase
HCL
11
star
12

scp-tools-gitlab

🦊 Docker Image with SAP Cloud Platform Tools (SAP Business Technology Platform) optimized for GitLab Runner and Google Cloud Build
Dockerfile
11
star
13

google-workload-identity-federation

πŸ” Google Cloud Workload Identity Federation Examples and How-To
10
star
14

sap-on-gcp-scripts

β˜• SAP on Google Cloud Platform Boilerplate
Shell
8
star
15

toolbox

πŸ”§ Toolbox - Script Collection
Jupyter Notebook
7
star
16

cloud-tools-container

πŸ“¦ Ready-to-use Docker container image with cloud tools (AWS CLI, Google Cloud CLI, Terraform, Packer, Ansible)
Dockerfile
7
star
17

iot-maneki-neko

🐱 IoT Maneki-Neko (Beckoning Cat, Luck Cat, Winkekatze)
C++
7
star
18

macos-missing-shutdown-app

🍎 macOS Shutdown, Restart, Sleep and Log Out App
6
star
19

iot-weather-mqtt

☁️ WiFi Weather Sensor that talks MQTT (SAP IoT Cloud Ready)
C++
6
star
20

aws-pricing

πŸ’Έ Choose the optimal Amazon EC2 instance type in the many AWS locations
Perl
6
star
21

quarqd

πŸ’‘ quarqd is a daemon for communicating with an ANT+ device
C
5
star
22

obs-emoji

πŸ˜ƒ Emoji Live Reactions Animation for OBS (Open Broadcaster Software)
HTML
5
star
23

dotfiles

⌨ My dotfiles and script to perform user-defined configurations
Shell
4
star
24

google-cloud-iam

☁️ Google Cloud Identity and Access Management (IAM)
Perl
3
star
25

terraform-google-quota-limits

πŸŒͺ️ Terraform module to update Google Cloud consumer quota limits
HCL
3
star
26

blocklocker

πŸ”— IoT Blockchain Locker
Perl
3
star
27

notify-me

πŸ“Ÿ CLI scripts to get notified via MS Teams, Discord, Pushover, sipgate SMS and many more...
Perl
3
star
28

veloherodown

🚴 Create a local copy of your Velo Hero data
Shell
3
star
29

terraform-google-wif-github

πŸ” Terraform module to create a Google Cloud Workload Identity Pool and Provider for GitHub Actions
HCL
2
star
30

terraform-google-wif-service-account

πŸ” Terraform module to allow login via Google Cloud Workload Identity Pool and Provider for service accounts
HCL
2
star
31

iot-consumption

☁️ SAPUI5 app for the built-in MMS OData API from the SAP Cloud IoT
JavaScript
2
star
32

google-cloud-gcp-pfsense

☁️ Connect your pfSense firewall to the Google Cloud Platform (GCP) via IPsec VPN (even with non-static IP address)
Shell
2
star
33

qmk-massdrop-ctrl

⌨️ My custom QMK Massdrop CTRL firmware
C
1
star
34

Cyclenerd

😎 My GitHub Profile README
1
star
35

google-cloud-unused-service-accounts

πŸ€– Detect unused Service Accounts in Google Cloud Platform
Shell
1
star
36

google-cloud-identity-platform

πŸ”‘ Google Cloud Identity Platform Examples and How-To (Sign in with GitHub, GitLab, Microsoft, Google)
HTML
1
star
37

SapMachineInstaller

SapMachine (SAP supported version of OpenJDK) Windows Installer
NSIS
1
star
38

veloheroup

🚴 Command line interface for uploading to Velo Hero
Shell
1
star
39

google-cloud-appengine-mail-api

πŸ“§ Create your own Mail API based on Google App Engine (GAE)
Python
1
star
40

terraform-google-wif-gitlab

πŸ” Terraform module to create a Google Cloud Workload Identity Pool and Provider for GitLab CI
HCL
1
star