# LibreNMS

EvoHub receives LibreNMS alerts through an alert transport of type **API**. A rule that fires opens an EvoHub alert; its recovery resolves it.

## Set it up

:::steps
### Create the integration
In EvoHub, go to **On-Call → Integrations → + Add Integration**, choose **LibreNMS**, pick an **Escalation Policy** and click **Create Integration**. Copy the **Webhook URL**.
### Create the transport
In LibreNMS, go to **Alerts → Alert Transports → Create alert transport** and choose the type **API**. Set **API Method** to `POST` and **API URL** to your webhook URL **without** the `?key=…` part, for example `https://evohub.io/ingest/librenms`. Put the key in **Options** as `key=YOUR_INTEGRATION_KEY` (the part of the webhook URL after `key=`). Set **Headers** to `Content-Type=application/json` and paste the body below on one line.
### Test it
Click **Test**. LibreNMS sends its test alert; EvoHub answers with success and opens no alert.
### Use it in rules
Attach the transport to your alert rules (or make it a default transport) and keep **Recovery alerts** on in each rule. Without it LibreNMS never tells EvoHub the alert has cleared.
:::

```json
{"title":{{ $title|json_encode }},"rule":{{ $name|json_encode }},"rule_id":{{ $rule_id|json_encode }},"alert_id":{{ $alert_id|json_encode }},"device_id":{{ $device_id|json_encode }},"hostname":{{ $hostname|json_encode }},"sysName":{{ $sysName|json_encode }},"ip":{{ $ip|json_encode }},"os":{{ $os|json_encode }},"location":{{ $location|json_encode }},"severity":{{ $severity|json_encode }},"state":{{ $state|json_encode }},"timestamp":{{ $timestamp|json_encode }}}
```

> [!WARNING]
> Keep the key out of the **API URL**. LibreNMS's API transport throws away everything after the `?` in the URL and sends the **Options** as the query string instead, so a key typed into the URL never reaches EvoHub and every alert is refused with `401`.

> [!NOTE]
> `|json_encode` writes each value as a quoted, escaped JSON string, which is why the placeholders have no quotes around them. The filter exists from LibreNMS 25.7. On an older LibreNMS write each value in quotes without the filter — `"title":"{{ $title }}"` — and EvoHub repairs line breaks, quotes and backslashes that end up inside values. The same fields also work with **Send as form**.

## What EvoHub reads

| EvoHub alert | Taken from |
| --- | --- |
| Title | `title`, or the rule name and host name. |
| Description | The rule and the device (host name, sysName, IP). |
| Labels | `hostname`, `sysName`, `ip`, `os`, `location`, `rule`, `rule_id`, `device_id`, `severity`, `state`, `timestamp`. |

### Severity

| LibreNMS severity | EvoHub severity |
| --- | --- |
| critical | critical |
| warning | medium |

## Resolve and deduplication

An alert is identified by the rule and the device. States *active*, *worse*, *better* and *changed* open the alert or are recorded as **Retriggered** on it; *recovered* (state `0`) resolves it. Acknowledging the alert in LibreNMS (state `2`) changes nothing in EvoHub.

## Related

- [Integrations overview](https://docs.evohub.io/integrations-overview.md)
- [ManageEngine OpManager](https://docs.evohub.io/manageengine-opmanager.md)
