module

JaneHQ::AlertRules

The condition and action vocabularies an alert group is built from. Kept here (not in the DB) because they are properties of the Jane agent's check families, not user data.

Constants

ALERT_COUNTS = [Option.new("once", "Once"), Option.new("recurring", "Alert by Time Frequency")]

How many times an alert fires: once, or repeatedly at ALERT_FREQUENCIES.

ALERT_FREQUENCIES = [Option.new("1", "every 1 min"), Option.new("3", "every 3 min"), Option.new("5", "every 5 min"), Option.new("10", "every 10 min"), Option.new("15", "every 15 min"), Option.new("30", "every 30 min"), Option.new("45", "every 45 min"), Option.new("60", "every 1 hour"), Option.new("120", "every 2 hours"), Option.new("180", "every 3 hours"), Option.new("360", "every 6 hours"), Option.new("720", "every 12 hours"), Option.new("1440", "every 24 hours"), Option.new("2880", "every 48 hours"), Option.new("4320", "every 72 hours"), Option.new("10080", "every 168 hours (1 week)")]

Repeat interval, in minutes, when alert_count is "recurring".

ALERT_TYPES = [AlertType.new("exec", "Execute program", "Program to run", "/usr/local/bin/page-oncall.sh"), AlertType.new("email", "Send email", "Email address", "alerts@example.com"), AlertType.new("slack", "Slack alert", "Slack webhook URL", "https://hooks.slack.com/services/...")]
DEFAULT_ALERT_COUNT = "once"
DEFAULT_ALERT_FREQUENCY_MINUTES = 15
DEFAULT_ALERT_TYPE = "email"
DEFAULT_STATUSES = ["failed", "changed"]

What a new alert group starts with — the same default M/Monit uses.

EVENTS = [Option.new("cpu_usage", "CPU usage"), Option.new("cpu_io_wait", "CPU I/O wait"), Option.new("load_average", "Load average"), Option.new("memory_usage", "Memory usage"), Option.new("filesystem_space", "Filesystem space"), Option.new("network_interface", "Network interface"), Option.new("network_connection", "Network connection"), Option.new("bandwidth", "Bandwidth"), Option.new("process", "Process"), Option.new("file_existence", "File existence"), Option.new("file_permission", "File permission"), Option.new("file_uid", "File owner"), Option.new("file_gid", "File group")]

The check families the agent emits (jane/src/utils/*.cr). event_for maps a reported check name back to one of these.

STATUSES = [Option.new("succeeded", "Succeeded"), Option.new("failed", "Failed"), Option.new("changed", "Changed")]

Jane reports each check as "ok" or "alert", which are Succeeded and Failed here; "changed" is a transition between the two, so it is derived when a report lands rather than sent by the agent.

Class methods

alert_count(value : String) : Option
Source
alert_count?(value : String) : Option | Nil
Source
alert_frequency_label(minutes : Int32) : String
Source
alert_type(value : String) : AlertType
Source
alert_type?(value : String) : AlertType | Nil
Source
event_for(check_name : String) : String | Nil

Which event family a reported check name belongs to. Order matters: the File attribute checks ("File etc user") are suffixes of the plain existence check ("File etc").

Source
event_label(value : String) : String
Source
event_label_for(check_name : String) : String | Nil

The event a check name belongs to, as a label — shown as a hint beside each service in the form's Service picker.

Source
event_labels(values : Array(String)) : Array(String)
Source
known_events(values : Array(String)) : Array(String)
Source
known_statuses(values : Array(String)) : Array(String)

Catalog order, unknown values dropped — how submitted picker values are normalized before they are stored.

Source
status_labels(values : Array(String)) : Array(String)
Source

Nested types