static_status

🚦Bash script to generate a static status page.
授权协议 GPL-3.0 License
开发语言 SHELL
所属分类 应用工具、 终端/远程登录
软件类型 开源软件
地区 不详
投 递 者 洪捷
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

status.sh

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.

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 Bash script status.sh:

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

�� Tip: Update works exactly the same way as the installation. Simply download the latest version of status.sh.

2️⃣ Download configuration file status_hostname_list.txt:

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

3️⃣ 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

Custom Text

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

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

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_a|see symbolic link example

Please note that you do not pass any parameters. You can work with symbolic links. Example:

$ ln -sf script.sh script_a
$ ln -sf script.sh script_b
$ ls -lah
script_a -> script.sh
script_b -> script.sh

Example script.sh:

#!/bin/bash

MY_NAME=$(basename "$0")

case "$MY_NAME" in
"script_a")
  echo "A"
  exit 0
  ;;
"script_b")
  echo "B"
  exit 0
  ;;
esac

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_shell).

  • 简介: 与dynamic_cast对应的是static_cast(静态强制)。static_cast关键字一般用来将枚举类型转换成整型,或者短整形转换成长整形,又或者整型转换成浮点型。也可以用来将指向父类的指针转换成指向子类的指针。  数据类型转换系列文章: C++中的动态强制dynamic_cast C++中的RTTI机制之typeid C++中的静态强制static_cast C++中的rei

  • 关于 nginx 的 gzip ,可以分为两种: nginx 动态压缩,对每个请求先压缩再输出。 nginx 静态压缩,使用现成的扩展名为 .gz 的预压缩文件。 nginx 动态压缩 开启 nginx 动态压缩只需要在 nginx.conf 文件中做如下修改即可: # 开启和关闭gzip模式 gzip on; # gizp压缩起点,文件大于1k才进行压缩 gzip_min_length 1k;

  • 错误提示:Check failed: mdb_status == 0 (2 vs. 0) No such file or directory,创建数据层mnist是找不到mdb文件 I0417 13:28:17.764714 35030 layer_factory.hpp:77] Creating layer mnist F0417 13:28:17.765067 35030 db_lmdb.hp

  • #开启和关闭gzip模式 gzip on; #gizp压缩起点,文件大于1k才进行压缩 gzip_min_length 1024k; #gzip 压缩级别,1-9,数字越大压缩的越好,也越占用CPU时间 gzip_comp_level 4; #进行压缩的文件类型。 gzip_types text/plain application/x-javascript text/css applicat

  • 解剖Nginx·模块开发篇(5)解读内置非默认模块 ngx_http_stub_status_module 作者:柳大·Poechant(钟超) 邮箱:zhongchao.ustc#gmail.com(# -> @) 博客:Blog.CSDN.net/Poechant 日期:June 3nd, 2012 1 Background ngx_http_stub_status_module 是一个 Ng

  • /tmp/ccWem6tZ.o:在函数‘__static_initialization_and_destruction_0(int, int)’中: p.cpp:(.text+0x651): 截断重寻址至相符: R_X86_64_PC32 针对 .bss p.cpp:(.text+0x664): 截断重寻址至相符: R_X86_64_PC32 针对 .bss collect2: error: ld

  • rh_call_control 为了说明rh_call_control,先来看看是如何通过usb_control_msg,接着usb_submit_urb,然后rh_urb_enqueue,最终在调用rh_call_control的过程。 hub信息获取函数 get_hub_descriptor(struct usb_device *hdev, void *data) usb_contro

  • 问题 CUDA9.2+Anaconda5.0+Pytorch1.0.0( py3.7_cuda90_cudnn7_1)安装完成后,不调用GPU跑程序,可以正常运行,当调用cuda()后出错:RuntimeError: cuDNN error: CUDNN_STATUS_EXECUTION_FAILED 而同样的代码在Ubuntu下运行正常。 // 出错提示如下 Traceback (most re

  • 前几天对项目进行了webpack打包优化,开启了webpack的gzip功能,打包出来的.gz需要nginx开启gzip功能才能使用,要不然加载资源会报404;新增nginx配置如下: #开启和关闭gzip模式 gzip on; #gizp压缩起点,文件大于1k才进行压缩 gzip_min_length 1024k; #gzip 压缩级别,1-9,数字越大压缩的越好,也越占用CPU时间 gzi

  • 网上找了一圈,也没找到答案,最后发现还是自己代码里有BUG,最后分类的时候对应的类别数目不一致

  • //static void exit(int status) 终止当前使用的虚拟机 for (int i=0;i<10;i++) { if (i==5) { System.exit(0); } System.out.println(i); }

  • 在学习若依的时候,发现若依自己设计了一套HTTP状态码java类,个人觉得以后可以借鉴以下,在此记录以下: public class HttpStatus { /** * 操作成功(常用) */ public static final int SUCCESS = 200; /** * 对象创建成功 */ public sta

相关阅读

相关文章

相关问答

相关文档