fstaid is a daemon that monitors the health condition of the server and executes the script if there is any problem.
Go Makefile Ruby
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
debian
etc
homebrew
pkg
src/fstaid
.gitignore
.travis.yml
LICENSE.txt
Makefile
README.md
fstaid.spec
fstaid.toml.sample
main.go

README.md

fstaid

fstaid is a daemon that monitors the health condition of the server and executes the script if there is any problem.

Build Status

Flowchart

Usage

Usage of fstaid:
  -config string
    	config file path (default "fstaid.toml")
  -version
    	show version

Configuration

[global]
port = 8080
interval = 1
maxattempts = 3
attempt_interval = 0.1
#lockdir = "/tmp"
#log = "/var/log/fstaid.log"
#mode = "debug"(default) / "release"
#continue_if_self_check_failed = false

[handler]
command = "/usr/libexec/fstaid/handler.rb"
timeout = 300

[primary]
command = "curl -s -f server-01"
timeout = 3

[secondary]
command = "curl -s -f -x server-02:8080 server-01"
timeout = 3
# secondary check is not required

[self]
command = "curl -s -f 169.254.169.254/latest/meta-data/instance-id"
timeout = 3
# self check is not required

[[user]]
userid = "foo"
password = "bar"

Handler Example

#!/usr/bin/env ruby
# The handler is called when both the primary check and the secondary check fail

primary_exit_code   =  ARGV[0].to_i
primary_timeout     = (ARGV[1] == 'true')
secondary_exit_code =  ARGV[2].to_i
secondary_timeout   = (ARGV[3] == 'true')

def failover
  # to fail over
end

if primary_exit_code != 0
  if secondary_timeout
    # Nothing to do if the secondary-check times out
    exit 1
  end

  failover
elsif primary_timeout
  # Nothing to do if the primary-check times out
  exit 2
end

Web Interface

  • GET /ping: ping
  • GET /fail: force failover