Hemdal.Config behaviour (Hemdal v1.2.1)
View SourceHemdal needs to load a configuration to get the checks to be processed, how to trigger the alerts and how to connect to the systems to perform the checks.
This module define all of the data needed for the configuration and the contract needed to be followed for the libraries which are going to act as backend systems.
The backend is configured in the following way:
# config/config.exs
config :hemdal, config_module: Hemdal.Config.Backend.Env
The possible backends and supported officially are:
Hemdal.Config.Backend.Env
which is configuring viaconfig.exs
in the Elixir configuration way.Hemdal.Config.Backend.Json
which is using JSON files.
Check those modules to get further information about the implementation and usage.
Summary
Callbacks
Retrieve an alert giving an alert_id
.
Get all of the alerts. It should provide a way to retrieve a list with
the alerts in the format defined by Hemdal.Config.Alert
or an empty
list.
Retrieve all of the hosts. The implementation of this callback should
provide a list of Hemdal.Config.Host
or an empty list.
Retrieve the host giving a host_id
.
Functions
Retrieves the alert giving an alert_id
using the configured backend.
Retrieve all of the alerts using the configured backend.
Retrieve all of the hosts using the configured backend.
Retrieve the host giving a host_id
using the configured backend.
Callbacks
@callback get_alert_by_id!(id :: String.t()) :: Hemdal.Config.Alert.t() | nil
Retrieve an alert giving an alert_id
.
@callback get_all_alerts() :: [Hemdal.Config.Alert.t()]
Get all of the alerts. It should provide a way to retrieve a list with
the alerts in the format defined by Hemdal.Config.Alert
or an empty
list.
@callback get_all_hosts() :: [Hemdal.Config.Host.t()]
Retrieve all of the hosts. The implementation of this callback should
provide a list of Hemdal.Config.Host
or an empty list.
@callback get_host_by_id!(id :: String.t()) :: Hemdal.Config.Host.t() | nil
Retrieve the host giving a host_id
.
Functions
Retrieves the alert giving an alert_id
using the configured backend.
Retrieve all of the alerts using the configured backend.
Retrieve all of the hosts using the configured backend.
Retrieve the host giving a host_id
using the configured backend.