n8n-workflows/workflows/34_Monitoring_and_alerting.json
2025-05-14 11:58:29 +03:00

141 lines
2.6 KiB
JSON

{
"id": "34",
"name": "Monitoring and alerting",
"nodes": [
{
"name": "Cron",
"type": "n8n-nodes-base.cron",
"position": [
250,
200
],
"parameters": {},
"typeVersion": 1
},
{
"name": "Postgres",
"type": "n8n-nodes-base.postgres",
"position": [
450,
200
],
"parameters": {
"query": "SELECT * FROM n8n WHERE value > 70 AND notification = false;",
"operation": "executeQuery"
},
"credentials": {
"postgres": "Postgres"
},
"typeVersion": 1
},
{
"name": "Twilio",
"type": "n8n-nodes-base.twilio",
"position": [
650,
200
],
"parameters": {
"to": "",
"from": "",
"message": "=🚨 The Sensor ({{$node[\"Postgres\"].json[\"sensor_id\"]}}) showed a reading of {{$node[\"Postgres\"].json[\"value\"]}}."
},
"credentials": {
"twilioApi": "Twilio"
},
"typeVersion": 1
},
{
"name": "Set",
"type": "n8n-nodes-base.set",
"position": [
850,
200
],
"parameters": {
"values": {
"number": [
{
"name": "id",
"value": "={{$node[\"Postgres\"].json[\"id\"]}}"
}
],
"boolean": [
{
"name": "notification",
"value": true
}
]
},
"options": {},
"keepOnlySet": true
},
"typeVersion": 1
},
{
"name": "Postgres1",
"type": "n8n-nodes-base.postgres",
"position": [
1050,
200
],
"parameters": {
"table": "n8n",
"columns": "notification",
"operation": "update"
},
"credentials": {
"postgres": "Postgres"
},
"typeVersion": 1
}
],
"active": false,
"settings": {},
"connections": {
"Set": {
"main": [
[
{
"node": "Postgres1",
"type": "main",
"index": 0
}
]
]
},
"Cron": {
"main": [
[
{
"node": "Postgres",
"type": "main",
"index": 0
}
]
]
},
"Twilio": {
"main": [
[
{
"node": "Set",
"type": "main",
"index": 0
}
]
]
},
"Postgres": {
"main": [
[
{
"node": "Twilio",
"type": "main",
"index": 0
}
]
]
}
}
}