How to Aggregate Multiple Checkmk Webhook Alerts into One Message?

I’m trying to combine multiple alerts from Checkmk into a single summary message in Lark. Checkmk sends a separate notification (via a webhook script) for every service that changes state (e.g., 20 services go CRITICAL = 20 webhook calls). My current workflow (Webhook → Loop → Lark) sends 20 messages, which is too spammy.

Share the output returned by the last node

[
{
“headers”: {
“host”: “n8n.paas.alitec.asia”,
“x-real-ip”: “115.134.109.205”,
“x-forwarded-for”: “115.134.109.205”,
“x-forwarded-proto”: “https”,
“connection”: “upgrade”,
“content-length”: “595”,
“content-type”: “application/json”,
“user-agent”: “PostmanRuntime/7.43.3”,
“accept”: “/”,
“postman-token”: “18e89046-3d59-4b6c-b6ef-7b95c6371b15”,
“accept-encoding”: “gzip, deflate, br”
},
“params”: {},
“query”: {},
“body”: [
{
“notification_type”: “FLAPPINGSTART”,
“host_name”: “ubuntu-test-droplet”,
“host_alias”: “ubuntu-test-droplet”,
“host_state”: “DOWN”,
“host_state_type”: “”,
“host_output”: “OK - 167.172.79.71 rta 0.768ms lost 0%”,
“service_description”: “Uptime”,
“service_state”: “CRITICAL”,
“service_state_type”: “”,
“service_output”: “Up since 2025-04-07 20:11:01, Uptime: 2 days 6 hours”,
“contact_name”: “odoo_monitor_test”,
“checkmk_url”: “”,
“alert_time”: “Thu Apr 10 02:15:00 UTC 2025”
}
],
“webhookUrl”: “https://n8n.paas.alitec.asia/webhook-test/c4bad964-1a08-4830-bcc6-caa5710530cd”,
“executionMode”: “test”,
“myNewField”: 1
}
]

Information on your n8n setup

  • n8n version: n8nio/n8n:latest
  • Running n8n via Docker:
  • Operating system: macOS

Hi,

As far as I can see, each external event triggers the webhook as an independent execution and between each execution they have no access to and about each other. so the normal outcome is that it sends 20 individual messages.

There might be other ways but IMHO you need external storage to store state

Something like this:
Webhook call X is triggered y times → writes into a file or DB , this event , this time has happened

An additional WF or trigger detects (new file or new rows in DB:
get triggered. waits Z amount of time (you define this) and after that it reads all the events that happened between the first one and the wait time and send one message out with all the events.

this allows for the events to be combined and you have still all the original data about when and what.

regards,
J.

2 Likes

Hello, thank you for your suggestion; I appreciate it.

This is my current workflow:
Webhook → filter status → edit fields → store in postgres

My sub-workflow:
Every 1 minute trigger → fetch new records exist in db → code to group them by hostname → send it to Lark

I shouldn’t be struggling with the fact that I must send all services down in one message. In real world that rarely happens, and it’s not wrong to send per message per service (Duting testing, ofc it spam >22 messages together this is bad)

Btw, thank you again for your time.

1 Like

Hi, you are right. During a production event it’s better to receive 20 individual messages as compared to 1 aggregated. As with the latter one you might mis-judge the gravity. Good luck :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.