MyNixOS website logo
Description

An extensible dead-man's switch system.

Vigilance is a dead man's switch (See https://en.wikipedia.org/wiki/Dead_man%27s_switch) (or vigilance switch). You define named @watches that you expect to happen and how long to wait inbetween before it's time to worry. You then instrument your periodical tasks, whatever they are, to report to vigilance via a simple HTTP POST or with the included client. You can then configure notifications that will fire when a watch fails to check in. View the README on the homepage for more details. Install notes: On client installs where you may not want to install the server component, configure like:

cabal configure -fno-server

On client installs where you may not want to install the client component, configure like:

cabal configure -fno-client

Vigilance

Build Status

Vigilance is a dead man's switch (or vigilance switch). You define named watches that you expect to happen and how long to wait inbetween before it's time to worry. You then instrument your periodical tasks, whatever they are, to report to vigilance via a simple HTTP POST or with the included client. You can then configure notifications that will fire when a watch fails to check in.

Concepts

A watch is a named task that you expect to happen periodically. Watches have an interval at which they are expected to check in at the latest, i.e. every 5 minutes. Watches can be in several states:

  • Active - The clock is ticking but this watch has not yet triggered.
  • Paused - The clock is not ticking. Watches start out in this state. That means that you must unpause or check-in the watch to start the watch.
  • Notifying - The watch has failed to check in and will notify soon.
  • Triggered - The watch has failed to check in and has notified. It will not notify until it is dealt with, either by pausing, checkin in on removal.

Watches are configured in the server's config file and managed via the rest API or the vigilance client. The configuration file can be reloaded to account for changes/additions/removals of watches.

Watches can be configured with multiple notifications to fire when the watch fails to check in. Right now the supported notification options are:

  • Email - currently uses a local sendmail service.
  • HTTP POST

vigilance-server

vigilance-server is the server component of vigilance. It is responsible for tracking what watches there are, their state, notifications, etc.

Usage

Simply run vigilance-server path/to/config.cfg. If you don't specify a config, it will look in ~/.vigilance/server.conf

Configuration

The configuration file is in configurator format. Here's an example config

Example Config

vigilance {
  port = 9999
  from_email = "[email protected]"
  max_retries = 5
  log {
    verbose = on
    path = "log/vigilance.log"
  }
  watches {
    foo {
      interval = [2, "seconds"]
      notifications = [
        ["http", "http://localhost:4567/notify"],
        ["email", "[email protected]"]
      ]
    }

    bar {
      interval = [3, "minutes"]
    }
  }
}

Note that all of these options have reasonable defaults, so you don't need to specify them unless you need something other than the default.

Note that like the standard capabilities configurator has to expand env variables and load external config files apply:

vigilance {
  acid_path  = "$(HOME)/alternative-vigilance-path"

  watches {
    import "only_watches.conf"
  }
}

Limited Config Reload Support

Sending a HUP signal to the process (kill -HUP pid_of_vigilance) will reload the config. Reloading while running can currently update the following settings:

  1. Log verbosity.
  2. List of watches
  3. Log location

Config Fields

FieldDefaultDescriptionReloadable
port3000Server portNo
from_emailNoneEmail to send from. If missing, no email notificationsNo
max_retries3Max retries for notificationsNo
log.acid_path~/.vigilance/state/AppStateNo
log.verbosenoVerbose loggingYes
log.path~/.vigilance/vigilance.logYes
watches.name.intervalNone. Required for a watchPair of number and seconds/minutes/hours/days/weeks/yearsYes
watches.name.notificationsEmptyList of pairs ["http", "url"] or ["email", "[email protected]"]Yes

REST API

Vigilance exposes a REST API for managing watches.

PathMethodDescription
/watchesGETGet the list of watches in JSON.
/watches/nameGETGet info for a watch by name
/watches/nameDELETEDelete a watch. Make sure to remove it from the config or it will return on config (re)load.
/watches/name/pausePOSTTake a watch out of operation.
/watches/name/unpausePOSTPut a watch back in operation.
/watches/name/checkinPOSTCheck in a watch. Unpauses if it is paused.
/watches/name/testPOSTSynchronously fire a watch's notifications. Returns a list of failures in JSON.

Vigilance Client

Vigilance Client is available under the vigilance binary. It allows you to interact with a vigilance server over HTTP in a concise way. The idea behind this is that it should make it very easy to insert check-ins in crontabs and shell scripts. You can imagine a crontab entry like: @daily run_backups.sh && vigilance checkin backups.

Configuration

Vigilance by default looks for a .vigilance file in your home directory, which looks like:

vigilance
{
  host = "localhost"
  port = 3000
}

Usage

Run vigilance --help for help:

vigilance - tool for managing vigilance watches locally or remotely.

Usage: vigilance COMMAND [-c|--config FILE]

Available options:
  -h,--help                Show this help text
  -c,--config FILE         Config file. Defaults to ~/.vigilance

Available commands:
  list                     List watches
  pause                    Pause watch
  unpause                  Unpause watch
  checkin                  Check in watch
  info                     Get info about a watch
  test                     Test the notifications for a watch

All commands except list take a name argument for the watch like: vigilance pause foo.

Status

Gearing up for release. Nothing in the TODO necessitates holding up the release.

License

Vigilance is released under the MIT license. See the LICENSE file for more info.

Metadata

Version

0.1.0.1

License

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows