Hemdal.Config behaviour (Hemdal v1.0.5)

View Source

Hemdal 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:

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

get_alert_by_id!(id)

@callback get_alert_by_id!(id :: String.t()) :: Hemdal.Config.Alert.t() | nil

Retrieve an alert giving an alert_id.

get_all_alerts()

@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.

get_all_hosts()

@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.

get_host_by_id!(id)

@callback get_host_by_id!(id :: String.t()) :: Hemdal.Config.Host.t() | nil

Retrieve the host giving a host_id.

Functions

get_alert_by_id!(id)

Retrieves the alert giving an alert_id using the configured backend.

get_all_alerts()

Retrieve all of the alerts using the configured backend.

get_all_hosts()

Retrieve all of the hosts using the configured backend.

get_host_by_id!(id)

Retrieve the host giving a host_id using the configured backend.