Skip to content

sue445/zatsu_monitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zatsu(雑) Monitor

zatsu_monitor is simple url monitoring tool

Notify message to chatroom only if http status is changed from just before (e.g. 500 -> 200)

slack

Latest Version Build Status Code Climate Go Report Card

Getting

Download latest binary from here

https://github.com/sue445/zatsu_monitor/releases

Usage

/path/to/zatsu_monitor -config /path/to/config.yml -data /path/to/data_dir
  • -config: Path to config yaml file (see after)
  • -data: Cache dir. latest http status is stored to here

Help

$ ./zatsu_monitor --help
Usage of ./zatsu_monitor:
  -config string
    	Path to config file
  -data string
    	Path to data dir for cache
  -version
    	Whether showing version

Config yaml file format

Example

# zatsu_monitor.yml
google:
  type: slack
  check_url: "https://www.google.com/"

  api_token: "AAAAAAAA"
  # or
  # webhook_url: "https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/XXXXXXXXXXXXXXXX"

  channel: "#general"
  user_name: "zatsu_monitor"
  # check_only_top_of_status_code: true
github:
  type: chatwork
  check_url: "https://github.com/"
  api_token: "AAAAAAAA"
  room_id: "111111"
  # check_only_top_of_status_code: true

Detail

zatsu_monitor supports some notifier

  • type : slack (fixed value)
  • check_url : URL for checking (required)
  • api_token : Slack API Token (either api_token or webhook_url is required)
  • webhook_url : Slack Incoming Webhook URL (either api_token or webhook_url is required)
  • channel : Channel for post (required)
  • user_name : Name for post (optional. default is zatsu_monitor)
  • type : chatwork (fixed value)
  • check_url : URL for checking (required)
  • api_token : ChatWork API Token (required)
  • room_id : RoomID for post (required)

Common

  • check_only_top_of_status_code : Whether check only top of the status code (optional. default is false)
    • e.g) When check_only_top_of_status_code is true, before status code is 501 and current status code is 502, don't notify

ProTip

Inherit values

slack: &common
  type: slack
  channel: "#general"

  api_token: "xoxp-0000000000-0000000000-0000000000-000000"
  # or
  # webhook_url: "https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/XXXXXXXXXXXXXXXX"

github:
  # inherit common values
  <<: *common

  # override common values
  check_url: "https://github.com/"
  channel: "#github"

google:
  <<: *common
  check_url: "https://www.google.com/"
  channel: "#google"

Development

Setup

cp .env.example .env
vi .env

Changelog

https://github.com/sue445/zatsu_monitor/releases