Add n8n workflow and validation script for settings monitoring; fix missing weekend protection params
This commit is contained in:
411
n8n-workflow-check-sets.json
Normal file
411
n8n-workflow-check-sets.json
Normal file
@@ -0,0 +1,411 @@
|
||||
{
|
||||
"name": "MQL Trading Bots - Settings Validator",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"rule": {
|
||||
"interval": [
|
||||
{
|
||||
"field": "hours",
|
||||
"hoursInterval": 6
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"name": "Schedule Trigger",
|
||||
"type": "n8n-nodes-base.scheduleTrigger",
|
||||
"typeVersion": 1.1,
|
||||
"position": [
|
||||
250,
|
||||
300
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"command": "cd /home/garfield/mql-trading-bots && ls -la *.set 2>/dev/null | wc -l"
|
||||
},
|
||||
"name": "Count Set Files",
|
||||
"type": "n8n-nodes-base.executeCommand",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
450,
|
||||
300
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "8ef4b80d-8c5a-4ea3-9a5a-b8be7355f4a7",
|
||||
"leftValue": "={{ $json.stdout }}",
|
||||
"rightValue": "0",
|
||||
"operator": {
|
||||
"type": "number",
|
||||
"operation": "notEquals"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"name": "Files Exist?",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
650,
|
||||
300
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"command": "cd /home/garfield/mql-trading-bots && for f in confluence-*.set; do echo \"=== $f ===\"; grep -E 'InpMinStrength|InpMinConfluence|InpRequireAllAgree|InpDebugMode' \"$f\" | grep -v '^;'; done"
|
||||
},
|
||||
"name": "Check Confluence Sets",
|
||||
"type": "n8n-nodes-base.executeCommand",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
850,
|
||||
200
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"command": "cd /home/garfield/mql-trading-bots && for f in grid-*.set; do echo \"=== $f ===\"; grep -E 'MaxLevels|InpMaxDailyDrawdown|InpCloseBeforeWeekend' \"$f\" | grep -v '^;'; done"
|
||||
},
|
||||
"name": "Check Grid Sets",
|
||||
"type": "n8n-nodes-base.executeCommand",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
850,
|
||||
400
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"command": "cd /home/garfield/mql-trading-bots && grep -l 'InpMinConfluenceStrength' confluence-*.set 2>/dev/null || echo 'No invalid variables found'"
|
||||
},
|
||||
"name": "Check Invalid Variables",
|
||||
"type": "n8n-nodes-base.executeCommand",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
1050,
|
||||
200
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"command": "cd /home/garfield/mql-trading-bots && grep 'InpDebugMode=false' confluence-*.set grid-*.set 2>/dev/null | wc -l"
|
||||
},
|
||||
"name": "Count Debug Off",
|
||||
"type": "n8n-nodes-base.executeCommand",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
1050,
|
||||
400
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "e6b7c7d1-6d61-413f-90a4-5ce2e8b7dc2e",
|
||||
"leftValue": "={{ $json.stdout }}",
|
||||
"rightValue": "No invalid",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "notContains"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"name": "Invalid Vars Found?",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
1250,
|
||||
200
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "b7c8d9e0-f1a2-4b3c-5d6e-7f8a9b0c1d2e",
|
||||
"leftValue": "={{ $json.stdout }}",
|
||||
"rightValue": "0",
|
||||
"operator": {
|
||||
"type": "number",
|
||||
"operation": "notEquals"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"name": "Debug Disabled?",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
1250,
|
||||
400
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"name": "Merge Issues",
|
||||
"type": "n8n-nodes-base.merge",
|
||||
"typeVersion": 2.1,
|
||||
"position": [
|
||||
1450,
|
||||
300
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"to": "={{ $env.ALERT_EMAIL }}",
|
||||
"subject": "🚨 MQL Settings Issues Detected",
|
||||
"text": "=Issues found in MQL Trading Bots settings:
|
||||
|
||||
Invalid Variables Found:
|
||||
{{ $('Check Invalid Variables').item.json.stdout }}
|
||||
|
||||
Files with Debug Disabled: {{ $('Count Debug Off').item.json.stdout }}
|
||||
|
||||
Confluence Settings:
|
||||
{{ $('Check Confluence Sets').item.json.stdout }}
|
||||
|
||||
Grid Settings:
|
||||
{{ $('Check Grid Sets').item.json.stdout }}
|
||||
|
||||
Please review and fix ASAP.
|
||||
|
||||
Server: {{ $env.HOSTNAME }}
|
||||
Time: {{ $now }}"
|
||||
},
|
||||
"name": "Send Alert Email",
|
||||
"type": "n8n-nodes-base.emailSend",
|
||||
"typeVersion": 2.1,
|
||||
"position": [
|
||||
1650,
|
||||
200
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"content": "={{$json}}",
|
||||
"options": {}
|
||||
},
|
||||
"name": "No Action Needed",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
1650,
|
||||
500
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"command": "cd /home/garfield/mql-trading-bots && git diff --name-only HEAD~1 2>/dev/null | grep '\.set$' || echo 'No recent set file changes'"
|
||||
},
|
||||
"name": "Check Recent Changes",
|
||||
"type": "n8n-nodes-base.executeCommand",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
850,
|
||||
600
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"webhookUri": "={{ $env.DISCORD_WEBHOOK_URL }}",
|
||||
"text": "={ '🚨 **MQL Settings Alert**' if $json.stdout != 'No recent set file changes' and $json.stdout != '' else '✅ **MQL Settings Check** - All OK' }",
|
||||
"options": {}
|
||||
},
|
||||
"name": "Discord Notification",
|
||||
"type": "n8n-nodes-base.discord",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
1250,
|
||||
600
|
||||
]
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"staticData": null,
|
||||
"tags": [
|
||||
{
|
||||
"name": "trading",
|
||||
"id": "trading-tag",
|
||||
"createdAt": "2024-01-01T00:00:00.000Z",
|
||||
"updatedAt": "2024-01-01T00:00:00.000Z"
|
||||
},
|
||||
{
|
||||
"name": "mql5",
|
||||
"id": "mql5-tag",
|
||||
"createdAt": "2024-01-01T00:00:00.000Z",
|
||||
"updatedAt": "2024-01-01T00:00:00.000Z"
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"Schedule Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Count Set Files",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Count Set Files": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Files Exist?",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Files Exist?": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Check Confluence Sets",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Check Grid Sets",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
},
|
||||
{
|
||||
"node": "Check Recent Changes",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "No Action Needed",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Check Confluence Sets": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Check Invalid Variables",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Check Grid Sets": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Count Debug Off",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Check Invalid Variables": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Invalid Vars Found?",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Count Debug Off": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Debug Disabled?",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Invalid Vars Found?": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge Issues",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Debug Disabled?": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Merge Issues",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Merge Issues": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Send Alert Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Check Recent Changes": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Discord Notification",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user