Appearance
Uptime Kuma
Uptime Kuma is a self-hosted monitoring tool. When a monitor changes state it can call a webhook. OpsMerge can receive that webhook and keep one ticket per outage:
- The monitor goes DOWN: a ticket opens.
- It stays down and Kuma keeps notifying: each repeat adds an internal note to the same ticket, not a new ticket.
- It comes back UP: the ticket is resolved (or noted, or left alone; your choice).
- It fails again soon after: the same ticket reopens instead of a duplicate.
This runs as a workflow with an inbound webhook, so you can still add other actions to it, such as sending a message.
Setup
1. Create the workflow in OpsMerge
- Go to Monitoring → Workflows and create a workflow.
- Set Trigger type to Webhook Inbound.
- Set Source to Uptime Kuma. This fills in the recommended settings below and sets the cooldown to 0. Every value stays editable.
- Leave Secret blank to have a strong one generated, or paste your own (at least 24 characters).
- Choose the Client (and optionally Site) under Ticket defaults, so tickets land against the right customer.
- Save. The Webhook URL appears once the workflow is saved, and the secret is shown in full this once. Keep the page open until you've copied the header into Kuma (step 2.4).
Keep the cooldown at 0. The cooldown applies to the whole workflow, so with a cooldown a second monitor going down shortly after the first would be skipped.
2. Add the notification in Kuma
In Kuma, go to Settings → Notifications → Setup Notification and choose Webhook.
Post URL: paste the workflow's Webhook URL.
Request Body: choose Custom Body, then use Copy body in OpsMerge and paste it:
json{"monitor_id":"{{ monitorJSON['id'] }}","monitor_name":"{{ name }}","target":"{{ hostnameOrURL }}","state":"{{ heartbeatJSON['status'] }}","detail":"{{ msg }}"}Additional Headers: use Copy header in OpsMerge and paste it. It looks like
{"X-Webhook-Secret":"…"}.Copy header only appears straight after a save that set the secret. Once you reload the workflow, the secret shows hidden (
…and its last four characters) and can't be copied again. If you've lost it, clear Secret and save: a new secret is generated and shown once. Then update the header in Kuma, because the old secret stops working.Save the notification and turn it on for the monitors you want ticketed (or set it as the default for new monitors).
Kuma's own Test button sends a message with no monitor in it. OpsMerge answers it with test_received and creates nothing, so a green test in Kuma only proves the URL and secret are right. Use Test fire in OpsMerge to try the full flow.
Ticket behaviour
| Setting | Default | What it does |
|---|---|---|
| One ticket per outage | On | Repeat DOWNs for the same monitor go to the open ticket. Turned off, every DOWN opens a new ticket. |
| Comment on repeat DOWN | On | Adds Kuma's message to the open ticket as an internal note. Turned off, repeats are counted but not noted. |
| When the monitor comes back UP | Resolve | Resolve resolves the ticket with a note. Comment only adds a note and leaves the ticket open. Nothing ignores the UP. |
| Reopen if it fails again within N minutes | On, 30 | A DOWN within N minutes of the ticket being resolved reopens it. After that a new ticket opens. Allowed range 1 to 1440. Closed or cancelled tickets are never reopened. |
| Ignore PENDING | On | Kuma status 2, the monitor retrying before it reports DOWN. Turned off, it adds a note to an open ticket. |
| Ignore MAINTENANCE | On | Kuma status 3, a maintenance window. Turned off, it adds a note to an open ticket. |
PENDING and MAINTENANCE never open a ticket, whatever these settings say.
Ticket defaults
- Subject template:
[Kuma] is downby default. Usefor any key in the body. - Client and Site: where the ticket lands when no client key is mapped, or the mapped value doesn't match.
- Type, Category, Impact and Urgency: Kuma tickets default to an incident at impact 2, urgency 2.
The description always includes the monitor name, the monitored URL or host, and Kuma's message.
Field mapping
You can add your own keys to the Kuma custom body and map them onto ticket fields. This is how one Kuma instance can raise tickets for several customers.
| Ticket field | Matches by |
|---|---|
| Client | Exact name (not case-sensitive) or ID |
| Site | Name within the matched client, or ID |
| Type | incident, service_request, problem, change or task |
| Impact, Urgency | A number from 1 to 5 |
| Category | Name or ID |
| Form field: name | Any field on the ticket form for the chosen type; stored with the ticket |
- Incoming keys are top-level keys of the body: 1 to 64 lower-case letters, digits or underscores. Each key can be mapped once, and a workflow can have up to 20 mappings.
monitor_name,targetanddetailare built in and shown as read-only rows.- A value that doesn't match, such as an unknown client name, never stops the ticket. The default is used, and a note in the ticket description and the workflow's fire history says what happened.
- Keys you don't map are added to the end of the ticket description.
Field mapping and ticket defaults also work for a Generic webhook workflow, applied to its Create Ticket action.
Worked example
You monitor customer websites from one Kuma instance and want each customer's outages on their own client.
Make a separate Kuma notification per customer, with the customer's name added to the custom body:
json{"monitor_id":"{{ monitorJSON['id'] }}","monitor_name":"{{ name }}","target":"{{ hostnameOrURL }}","state":"{{ heartbeatJSON['status'] }}","detail":"{{ msg }}","client":"Acme Ltd","priority":"1"}In the workflow, add two mappings:
client→ Client andpriority→ Urgency.Set your own company as the default client, so anything unmatched still lands somewhere you will see it.
When Acme's site goes down, a ticket opens on Acme Ltd at urgency 1. Three more DOWN notifications add three notes. When the site recovers, the ticket is resolved. If it falls over again 10 minutes later, the same ticket reopens.
Testing
On a saved workflow, open Test fire and use Send test DOWN and Send test UP. They send a sample Kuma message for a test monitor through the real receiver and show the result, for example DOWN → ticket #4821 created. Repeated test DOWNs land on the same test ticket, exactly as a real outage would. Close the test ticket when you are done.
The test uses the saved settings, so save before testing a change.
How OpsMerge answers Kuma
Every message OpsMerge handles gets a 200 response, including ones it deliberately skips, so Kuma never logs a failure for them. The body says what happened, for example {"data":{"result":"commented","ticket_id":"…","ticket_number":4821}}. Possible results are created, commented, reopened, resolved, deduped, skipped, ignored, cooldown and test_received.
- A wrong secret gets a
404, the same as an unknown workflow. - A body without a valid
state(0 to 3) gets a422. This usually means the custom body was not pasted, or Kuma is still set to send its default JSON.
Troubleshooting
Kuma shows an error and no ticket appears. Check the notification uses Custom Body and the header is pasted under Additional Headers. A 422 in Kuma's log means the body is wrong; a 404 means the URL or secret is wrong.
Every DOWN opens a new ticket. Turn One ticket per outage back on.
A second monitor's alert was skipped. The workflow has a cooldown. Set it to 0.
Tickets land on the wrong client. Check the mapped value matches the client's name exactly (case doesn't matter), or map the client's ID instead. The ticket description lists any value that didn't match.
Related
- Workflows — triggers, actions and inbound webhooks
- Integrations — everything else OpsMerge connects to