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
Current section
Files
lib/service_def.ex
defmodule Service.Def do
defstruct [:service_name, :mode, :timeout, :state, :computer_name, :notify_destination]
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, notify_destination: notify_destination}) do
"Watching service [*#{service_name}*] on [*#{computer_name}*] to be *#{mode}* every *#{timeout}* ms (*#{state}*), notify destination: #{inspect notify_destination}"
end
end
end