# `Alarmist.Alarm`
[🔗](https://github.com/nerves-project/alarmist/blob/v0.4.2/lib/alarmist/alarm.ex#L5)

DSL for defining managed alarms

The general form is:

```elixir
defmodule MyAlarmModule do
  use Alarmist.Alarm, level: :warning

  alarm_if do
    AlarmId1 and AlarmId2
  end
end
```

See `__using__/1` for options to pass to `use Alarmist.Alarm`.  See
`Alarmist.Ops` for what operations can be included in `alarm_if` block.

# `__using__`
*macro* 

Define a managed alarm

The following options can be passed to `use Alarmist.Alarm`:

* `:level` - the alarm severity. See `t:Logger.level/0`. Defaults to
  `:warning` and can be overridden by `Alarmist.set_alarm_level/2`.
* `:parameters` - a list of atom keys that refine the scope of the alarm. For
  example, a networking alarm might specify `[:ifname]` to indicate that the
  alarm pertains to a specific network interface.
* `:remedy` - a function or a {function, options} tuple. The function is
  called when the alarm is set. The function can either be a reference or MFA
  taking 0 or 1 arguments. If 1-arity, it is passed the `alarm_id`.
* `:style` - the alarm style when parameters are used. Defaults to
  `:tagged_tuple` to indicate that alarms are tuples where the first element
  is the alarm type and the subsequent elements are the parameters.

# `alarm_if`
*macro* 

Define an alarm condition

See `Alarmist.Ops` for what operations can be included in `alarm_if` block.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
