Packages

This is a GenServer-ish implementation of a Service watcher. A process that is designed to poll service state every given number of miliseconds and perform due actions in case it is not in designated state. The process is also capable of sending notifications to the configured recipient in Slack.

Current section

Files

Jump to
service_watcher_sup lib service_def.ex
Raw

lib/service_def.ex

defmodule Service.Def do
defstruct [:service_name, :mode, :timeout, :state, :computer_name]
alias Service.Def
defimpl String.Chars, for: __MODULE__ do
def to_string(%Def{service_name: service_name, mode: mode, timeout: timeout, state: state, computer_name: computer_name}) do
"Watching service [#{service_name}] on [#{computer_name}] to be #{mode} every #{timeout} ms (#{state})"
end
end
end