Hemdal.Config.Backend.Json (Hemdal v1.0.3)
View SourceConfiguration backend reader using JSON. See Hemdal.Config.Backend
for
further information.
The backend is needing the configuration (see Application
or Config
)
to know where the JSON file is located. You can write in the configuration
an entry like this:
# config/config.exs
import Config
config :hemdal, Hemdal.Config,
hosts_file: "hosts.json",
alerts_file: "alerts.json"
The hosts file is intended to configure all of the necessary hosts to be accessible to run the checks and the alerts are the configuration for each check.
An example of the hosts file is as follows:
[
{
"id": "2a8572d4-ceb3-4200-8b29-dd1f21b50e54",
"name": "localhost",
"module": "Hemdal.Host.Local",
"max_workers": 1
}
]
And an example for the alerts file is as follows:
[
{
"id": "52d13d6d-f217-4152-965d-cf5f488ceac4",
"name": "valid alert check",
"host_id": "2a8572d4-ceb3-4200-8b29-dd1f21b50e54",
"command": {
"name": "get ok status",
"type": "line",
"command": "echo '["OK", "valid one!"]'"
}
}
]
If you want to know more about what are the parameters you can use,
see Hemdal.Config.Alert
and Hemdal.Config.Host
for further information.
Summary
Functions
Get all of the alerts. It's reading the alerts file specified in the configuration and the hosts file to create the full information for the alert.
Get all of the hosts. It's reading the hosts file specified in the
configuration and returning it as a list of Hemdal.Config.Host
elements.
Functions
@spec get_all_alerts() :: [Hemdal.Config.Alert.t()]
Get all of the alerts. It's reading the alerts file specified in the configuration and the hosts file to create the full information for the alert.
@spec get_all_hosts() :: [Hemdal.Config.Host.t()]
Get all of the hosts. It's reading the hosts file specified in the
configuration and returning it as a list of Hemdal.Config.Host
elements.