将N8N审计和失败工作流发送到InfluxDB
高级
这是一个DevOps领域的自动化工作流,包含 29 个节点。主要使用 N8n, Set, Merge, SplitOut, Summarize 等节点。 通过InfluxDB仪表板监控工作流审计和失败情况
前置要求
- •可能需要目标 API 的认证凭证
分类
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "XIPHhh3HU6jfTgyC",
"meta": {
"instanceId": "bdce9ec27bbe2b742054f01d034b8b468d2e7758edd716403ad5bd4583a8f649",
"templateCredsSetupCompleted": true
},
"name": "将N8N审计和失败工作流发送到InfluxDB",
"tags": [
{
"id": "vfJ7DxaB1BnsVQhe",
"name": "Public",
"createdAt": "2025-06-23T09:52:14.318Z",
"updatedAt": "2025-06-23T09:52:14.318Z"
}
],
"nodes": [
{
"id": "8ed8f8ed-5352-4eb2-a0cf-2dbbc78f2a9a",
"name": "当点击“执行工作流”时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-780,
220
],
"parameters": {},
"typeVersion": 1
},
{
"id": "001ca208-f181-4270-be91-e30a316e624b",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
300,
-120
],
"parameters": {
"width": 1100,
"height": 520,
"content": "## 解析为Influx可理解的数据"
},
"typeVersion": 1
},
{
"id": "e4f3e592-8c71-4c0e-998e-3bb93ee12751",
"name": "数据库审计",
"type": "n8n-nodes-base.n8n",
"position": [
-180,
180
],
"parameters": {
"resource": "audit",
"operation": "generate",
"requestOptions": {},
"additionalOptions": {
"categories": [
"database"
]
}
},
"credentials": {
"n8nApi": {
"id": "jEwimv7sOrtA7wmd",
"name": "n8n account"
}
},
"typeVersion": 1
},
{
"id": "c719a748-8048-4471-a560-7abfe1249235",
"name": "文件系统审计",
"type": "n8n-nodes-base.n8n",
"position": [
-180,
360
],
"parameters": {
"resource": "audit",
"operation": "generate",
"requestOptions": {},
"additionalOptions": {
"categories": [
"filesystem"
]
}
},
"credentials": {
"n8nApi": {
"id": "jEwimv7sOrtA7wmd",
"name": "n8n account"
}
},
"typeVersion": 1
},
{
"id": "d0b36463-ee8d-4455-bffd-0217dacf3f47",
"name": "实例审计",
"type": "n8n-nodes-base.n8n",
"position": [
-180,
540
],
"parameters": {
"resource": "audit",
"operation": "generate",
"requestOptions": {},
"additionalOptions": {
"categories": [
"instance"
]
}
},
"credentials": {
"n8nApi": {
"id": "jEwimv7sOrtA7wmd",
"name": "n8n account"
}
},
"typeVersion": 1
},
{
"id": "d17b1536-0322-443b-a431-cbb60684e399",
"name": "节点审计",
"type": "n8n-nodes-base.n8n",
"position": [
-180,
720
],
"parameters": {
"resource": "audit",
"operation": "generate",
"requestOptions": {},
"additionalOptions": {
"categories": [
"nodes"
]
}
},
"credentials": {
"n8nApi": {
"id": "jEwimv7sOrtA7wmd",
"name": "n8n account"
}
},
"typeVersion": 1
},
{
"id": "a0750d26-f5bf-42e1-bd8b-ceb357d1c331",
"name": "凭据审计",
"type": "n8n-nodes-base.n8n",
"position": [
-180,
0
],
"parameters": {
"resource": "audit",
"operation": "generate",
"requestOptions": {},
"additionalOptions": {
"categories": [
"credentials"
]
}
},
"credentials": {
"n8nApi": {
"id": "jEwimv7sOrtA7wmd",
"name": "n8n account"
}
},
"typeVersion": 1
},
{
"id": "11e65615-0b5e-4e36-932b-3f2b335ea937",
"name": "分割报告数据",
"type": "n8n-nodes-base.splitOut",
"position": [
440,
200
],
"parameters": {
"include": "selectedOtherFields",
"options": {},
"fieldToSplitOut": "report",
"fieldsToInclude": "risk, report[0].title"
},
"typeVersion": 1
},
{
"id": "55071cff-b94b-4f15-b5ab-42a65ba90ed9",
"name": "准备Influx输入字符串",
"type": "n8n-nodes-base.set",
"position": [
700,
200
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "a62768f8-431f-48e7-b2a9-95971d9e1dc1",
"name": "title_key_count",
"type": "string",
"value": "={{ $json.report.title.toLowerCase().replaceAll(\" \",\"_\") }}={{ $json.report.location?.length ?? 0 }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "718a1193-1b98-4def-9a29-a81925d67e06",
"name": "用逗号连接",
"type": "n8n-nodes-base.summarize",
"position": [
960,
200
],
"parameters": {
"options": {},
"fieldsToSummarize": {
"values": [
{
"field": "title_key_count",
"aggregation": "concatenate"
}
]
}
},
"typeVersion": 1.1
},
{
"id": "bf04e182-1028-4e21-930e-8c3097fa060c",
"name": "拉取报告数据和风险凭据",
"type": "n8n-nodes-base.set",
"position": [
60,
0
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "de836603-6982-4b43-ae85-440f0852cd74",
"name": "report",
"type": "array",
"value": "={{ $json['Credentials Risk Report'].sections }}"
},
{
"id": "012bd4f1-9877-48fb-b5ab-f8e3e1d81dd3",
"name": "risk",
"type": "string",
"value": "={{ $json['Credentials Risk Report'].risk }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "b502d235-ddc4-49ce-8ae6-fdcfab1ca1a9",
"name": "拉取报告数据和风险数据库",
"type": "n8n-nodes-base.set",
"position": [
60,
180
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "de836603-6982-4b43-ae85-440f0852cd74",
"name": "report",
"type": "array",
"value": "={{ $json['Database Risk Report'].sections }}"
},
{
"id": "012bd4f1-9877-48fb-b5ab-f8e3e1d81dd3",
"name": "risk",
"type": "string",
"value": "={{ $json['Database Risk Report'].risk }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "fe8dfa8a-6363-49a6-808e-1feed4b627d1",
"name": "拉取报告数据和风险文件系统",
"type": "n8n-nodes-base.set",
"position": [
60,
360
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "de836603-6982-4b43-ae85-440f0852cd74",
"name": "report",
"type": "array",
"value": "={{ $json['Filesystem Risk Report'].sections }}"
},
{
"id": "012bd4f1-9877-48fb-b5ab-f8e3e1d81dd3",
"name": "risk",
"type": "string",
"value": "={{ $json['Filesystem Risk Report'].risk }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "d47b4d10-3abe-41bc-868e-4b855b9e8052",
"name": "拉取报告数据和风险实例",
"type": "n8n-nodes-base.set",
"position": [
60,
540
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "de836603-6982-4b43-ae85-440f0852cd74",
"name": "report",
"type": "array",
"value": "={{ $json['Instance Risk Report'].sections }}"
},
{
"id": "012bd4f1-9877-48fb-b5ab-f8e3e1d81dd3",
"name": "risk",
"type": "string",
"value": "={{ $json['Instance Risk Report'].risk }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "14bb0859-d7ca-4177-a833-94cb4c94990e",
"name": "拉取报告数据和风险节点",
"type": "n8n-nodes-base.set",
"position": [
60,
720
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "de836603-6982-4b43-ae85-440f0852cd74",
"name": "report",
"type": "array",
"value": "={{ $json['Nodes Risk Report'].sections }}"
},
{
"id": "012bd4f1-9877-48fb-b5ab-f8e3e1d81dd3",
"name": "risk",
"type": "string",
"value": "={{ $json['Nodes Risk Report'].risk }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "852bf036-611c-416e-83d5-e926e38bb8ba",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-280,
-120
],
"parameters": {
"color": 7,
"width": 560,
"height": 1020,
"content": "## 获取N8N审计"
},
"typeVersion": 1
},
{
"id": "127908d3-de5e-443b-a920-47569ea890b0",
"name": "Influx全局变量",
"type": "n8n-nodes-base.set",
"position": [
-520,
60
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "c764e57c-9936-48ad-a496-f6c9fc0e89b8",
"name": "influx_url",
"type": "string",
"value": "https://example.com"
},
{
"id": "a92bc5cc-0a87-4dd7-a49d-5c2584eaa57f",
"name": "influx_org",
"type": "string",
"value": "myorg"
},
{
"id": "c2f8fb92-64a5-4993-97ee-8c69a8c9865a",
"name": "influx_bucket",
"type": "string",
"value": "n8n"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "38b364a6-7d0a-4f63-bbd8-d6bab99515a8",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-560,
-120
],
"parameters": {
"color": 4,
"width": 260,
"height": 500,
"content": "## Influx变量"
},
"typeVersion": 1
},
{
"id": "545f2f20-0a55-4960-8455-c4e6323ba198",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-920,
-120
],
"parameters": {
"color": 5,
"width": 340,
"height": 500,
"content": "## 计划审计"
},
"typeVersion": 1
},
{
"id": "2beef8e7-7e88-4778-9e54-09dd9c6efca1",
"name": "每天一次",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-780,
60
],
"parameters": {
"rule": {
"interval": [
{
"triggerAtHour": 5
}
]
}
},
"typeVersion": 1.2
},
{
"id": "a3408974-4c32-4900-86cf-111dd3e5f9c6",
"name": "获取活动工作流",
"type": "n8n-nodes-base.n8n",
"position": [
-200,
-460
],
"parameters": {
"filters": {
"activeWorkflows": true
},
"requestOptions": {}
},
"credentials": {
"n8nApi": {
"id": "jEwimv7sOrtA7wmd",
"name": "n8n account"
}
},
"typeVersion": 1
},
{
"id": "ef5c8f0c-07ed-447a-a582-0659fad71972",
"name": "获取失败执行",
"type": "n8n-nodes-base.n8n",
"position": [
-200,
-300
],
"parameters": {
"filters": {
"status": "error"
},
"options": {},
"resource": "execution",
"returnAll": true,
"requestOptions": {}
},
"credentials": {
"n8nApi": {
"id": "jEwimv7sOrtA7wmd",
"name": "n8n account"
}
},
"typeVersion": 1
},
{
"id": "e842c4bd-a335-4144-b580-c92fc343d804",
"name": "计数活动",
"type": "n8n-nodes-base.summarize",
"position": [
40,
-460
],
"parameters": {
"options": {},
"fieldsToSummarize": {
"values": [
{
"field": "active"
}
]
}
},
"typeVersion": 1.1
},
{
"id": "e0dda14c-6d80-42fe-ae2e-1e79c8b8733b",
"name": "计数失败",
"type": "n8n-nodes-base.summarize",
"position": [
40,
-300
],
"parameters": {
"options": {},
"fieldsToSummarize": {
"values": [
{
"field": "id"
}
]
}
},
"typeVersion": 1.1
},
{
"id": "a2189f25-d741-434b-bf1d-acf4567239d2",
"name": "合并为一行报告",
"type": "n8n-nodes-base.merge",
"position": [
300,
-440
],
"parameters": {
"mode": "combine",
"options": {},
"combineBy": "combineByPosition"
},
"typeVersion": 3.2
},
{
"id": "104c9d98-1d76-44c6-962e-433761e8a14f",
"name": "调整字段名称",
"type": "n8n-nodes-base.set",
"position": [
540,
-440
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "a7e43bc0-7e7a-4095-855f-3d9c885180c6",
"name": "title_key_count",
"type": "string",
"value": "=active_workflows={{ $json.count_active }},failed_executions={{ $json.count_id }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "006dbe41-daab-46b4-bdf7-17af73878f80",
"name": "将工作流和失败发送到InfluxDB",
"type": "n8n-nodes-base.httpRequest",
"position": [
800,
-440
],
"parameters": {
"url": "={{ $('Influx Globals').item.json.influx_url }}/api/v2/write?org={{ $('Influx Globals').item.json.influx_org }}&bucket={{ $('Influx Globals').item.json.influx_bucket }}&precision=ms",
"body": "=audit,operational=workflows_and_failed {{ $json.title_key_count }} {{ $now.toMillis() }}",
"method": "POST",
"options": {},
"sendBody": true,
"contentType": "raw",
"sendHeaders": true,
"authentication": "genericCredentialType",
"rawContentType": "text/plain; charset=utf-8",
"genericAuthType": "httpHeaderAuth",
"headerParameters": {
"parameters": [
{
"name": "Accept",
"value": "application/json"
}
]
}
},
"credentials": {
"httpHeaderAuth": {
"id": "YN5PulrHXt0CjPaK",
"name": "Influx Token"
}
},
"typeVersion": 4.2
},
{
"id": "260f51c8-f69b-4b09-96ee-23a9c83b5ac3",
"name": "将审计发送到InfluxDB",
"type": "n8n-nodes-base.httpRequest",
"position": [
1200,
200
],
"parameters": {
"url": "={{ $('Influx Globals').item.json.influx_url }}/api/v2/write?org={{ $('Influx Globals').item.json.influx_org }}&bucket={{ $('Influx Globals').item.json.influx_bucket }}&precision=ms",
"body": "=audit,risk={{ $('Split Report Data').first().json.risk }} {{ $json.concatenated_title_key_count }} {{ $now.toMillis() }}",
"method": "POST",
"options": {},
"sendBody": true,
"contentType": "raw",
"sendHeaders": true,
"authentication": "genericCredentialType",
"rawContentType": "text/plain; charset=utf-8",
"genericAuthType": "httpHeaderAuth",
"headerParameters": {
"parameters": [
{
"name": "Accept",
"value": "application/json"
}
]
}
},
"credentials": {
"httpHeaderAuth": {
"id": "YN5PulrHXt0CjPaK",
"name": "Influx Token"
}
},
"typeVersion": 4.2
},
{
"id": "4830f6e4-efbc-4476-a515-1c4afaf6d5ec",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-280,
-580
],
"parameters": {
"color": 3,
"width": 1280,
"height": 440,
"content": "## 活动工作流和失败执行"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "ca8f70df-803e-4b9b-921d-2f2e65a961bb",
"connections": {
"Once a Day": {
"main": [
[
{
"node": "Influx Globals",
"type": "main",
"index": 0
}
]
]
},
"Nodes Audit": {
"main": [
[
{
"node": "Pull Report Data and Risk Nodes",
"type": "main",
"index": 0
}
]
]
},
"Count Active": {
"main": [
[
{
"node": "Merge Into One Reporting Line",
"type": "main",
"index": 0
}
]
]
},
"Count Failed": {
"main": [
[
{
"node": "Merge Into One Reporting Line",
"type": "main",
"index": 1
}
]
]
},
"Database Audit": {
"main": [
[
{
"node": "Pull Report Data and Risk Database",
"type": "main",
"index": 0
}
]
]
},
"Influx Globals": {
"main": [
[
{
"node": "Credentials Audit",
"type": "main",
"index": 0
},
{
"node": "Nodes Audit",
"type": "main",
"index": 0
},
{
"node": "Database Audit",
"type": "main",
"index": 0
},
{
"node": "Filesystem Audit",
"type": "main",
"index": 0
},
{
"node": "Instance Audit",
"type": "main",
"index": 0
},
{
"node": "Get Failed Executions",
"type": "main",
"index": 0
},
{
"node": "Get Active Workflows",
"type": "main",
"index": 0
}
]
]
},
"Instance Audit": {
"main": [
[
{
"node": "Pull Report Data and Risk Instance",
"type": "main",
"index": 0
}
]
]
},
"Filesystem Audit": {
"main": [
[
{
"node": "Pull Report Data and Risk Filesystem",
"type": "main",
"index": 0
}
]
]
},
"Adjust Field Name": {
"main": [
[
{
"node": "Send Workflows and Fails to InfluxDB",
"type": "main",
"index": 0
}
]
]
},
"Credentials Audit": {
"main": [
[
{
"node": "Pull Report Data and Risk Credentials",
"type": "main",
"index": 0
}
]
]
},
"Split Report Data": {
"main": [
[
{
"node": "Prepare Influx Input Strings",
"type": "main",
"index": 0
}
]
]
},
"Get Active Workflows": {
"main": [
[
{
"node": "Count Active",
"type": "main",
"index": 0
}
]
]
},
"Get Failed Executions": {
"main": [
[
{
"node": "Count Failed",
"type": "main",
"index": 0
}
]
]
},
"Send Audit to InfluxDB": {
"main": [
[]
]
},
"Contactenate with Commas": {
"main": [
[
{
"node": "Send Audit to InfluxDB",
"type": "main",
"index": 0
}
]
]
},
"Prepare Influx Input Strings": {
"main": [
[
{
"node": "Contactenate with Commas",
"type": "main",
"index": 0
}
]
]
},
"Merge Into One Reporting Line": {
"main": [
[
{
"node": "Adjust Field Name",
"type": "main",
"index": 0
}
]
]
},
"Pull Report Data and Risk Nodes": {
"main": [
[
{
"node": "Split Report Data",
"type": "main",
"index": 0
}
]
]
},
"Pull Report Data and Risk Database": {
"main": [
[
{
"node": "Split Report Data",
"type": "main",
"index": 0
}
]
]
},
"Pull Report Data and Risk Instance": {
"main": [
[
{
"node": "Split Report Data",
"type": "main",
"index": 0
}
]
]
},
"Pull Report Data and Risk Filesystem": {
"main": [
[
{
"node": "Split Report Data",
"type": "main",
"index": 0
}
]
]
},
"When clicking ‘Execute workflow’": {
"main": [
[
{
"node": "Influx Globals",
"type": "main",
"index": 0
}
]
]
},
"Pull Report Data and Risk Credentials": {
"main": [
[
{
"node": "Split Report Data",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 开发运维
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
GitHub 同步仪表板 - V2
具有提交历史和回滚功能的 GitHub 工作流版本控制仪表板
If
N8n
Set
+20
94 节点Eduard
开发运维
使用Slack和Asana的虚拟Scrum Master
基于AI的Scrum Master助手,集成OpenAI、Slack和Asana
Set
Code
Html
+10
35 节点Łukasz
项目管理
自动化n8n工作流备份至GitHub并追踪删除
自动化n8n工作流备份至GitHub并追踪删除
If
N8n
Set
+13
31 节点Marcial Ambriz
开发运维
Typebot 流程与 GitHub 双向同步,使用 Typebot API
Typebot 流程与 GitHub 双向同步,使用 Typebot API
If
Set
Code
+12
31 节点Marcial Ambriz
开发运维
Google Search Console和Analytics分析与AI优化
Google Search Console和Analytics数据分析与AI优化
Set
Xml
Html
+16
29 节点Łukasz
人工智能
INST安装程序
打包部署多个n8n工作流 - 含自动凭证映射
If
N8n
Set
+12
31 节点Wyeth
开发运维