thingsboard/monitoring/src/main/resources/root_rule_chain.json

429 lines
12 KiB
JSON

{
"ruleChain": {
"additionalInfo": null,
"name": "Root Rule Chain",
"type": "CORE",
"firstRuleNodeId": null,
"root": false,
"debugMode": false,
"configuration": null,
"externalId": null
},
"metadata": {
"firstNodeIndex": 12,
"nodes": [
{
"additionalInfo": {
"description": null,
"layoutX": 1202,
"layoutY": 221
},
"type": "org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNode",
"name": "Save Timeseries",
"singletonMode": false,
"configurationVersion": 0,
"configuration": {
"defaultTTL": 0,
"useServerTs": false,
"persistenceSettings": {
"type": "ON_EVERY_MESSAGE"
}
},
"externalId": null
},
{
"additionalInfo": {
"layoutX": 1000,
"layoutY": 167
},
"type": "org.thingsboard.rule.engine.telemetry.TbMsgAttributesNode",
"name": "Save Attributes",
"singletonMode": false,
"configurationVersion": 1,
"configuration": {
"scope": "CLIENT_SCOPE",
"notifyDevice": false,
"sendAttributesUpdatedNotification": false,
"updateAttributesOnlyOnValueChange": false
},
"externalId": null
},
{
"additionalInfo": {
"layoutX": 566,
"layoutY": 302
},
"type": "org.thingsboard.rule.engine.filter.TbMsgTypeSwitchNode",
"name": "Message Type Switch",
"singletonMode": false,
"configurationVersion": 0,
"configuration": {
"version": 0
},
"externalId": null
},
{
"additionalInfo": {
"layoutX": 1000,
"layoutY": 381
},
"type": "org.thingsboard.rule.engine.action.TbLogNode",
"name": "Log RPC from Device",
"singletonMode": false,
"configurationVersion": 0,
"configuration": {
"scriptLang": "TBEL",
"jsScript": "return '\\nIncoming message:\\n' + JSON.stringify(msg) + '\\nIncoming metadata:\\n' + JSON.stringify(metadata);",
"tbelScript": "return '\\nIncoming message:\\n' + JSON.stringify(msg) + '\\nIncoming metadata:\\n' + JSON.stringify(metadata);"
},
"externalId": null
},
{
"additionalInfo": {
"layoutX": 1000,
"layoutY": 494
},
"type": "org.thingsboard.rule.engine.action.TbLogNode",
"name": "Log Other",
"singletonMode": false,
"configurationVersion": 0,
"configuration": {
"scriptLang": "TBEL",
"jsScript": "return '\\nIncoming message:\\n' + JSON.stringify(msg) + '\\nIncoming metadata:\\n' + JSON.stringify(metadata);",
"tbelScript": "return '\\nIncoming message:\\n' + JSON.stringify(msg) + '\\nIncoming metadata:\\n' + JSON.stringify(metadata);"
},
"externalId": null
},
{
"additionalInfo": {
"layoutX": 1000,
"layoutY": 583
},
"type": "org.thingsboard.rule.engine.rpc.TbSendRPCRequestNode",
"name": "RPC Call Request",
"singletonMode": false,
"configurationVersion": 0,
"configuration": {
"timeoutInSeconds": 60
},
"externalId": null
},
{
"additionalInfo": {
"layoutX": 255,
"layoutY": 301
},
"type": "org.thingsboard.rule.engine.filter.TbOriginatorTypeFilterNode",
"name": "Is Entity Group",
"singletonMode": false,
"configurationVersion": 0,
"configuration": {
"originatorTypes": [
"ENTITY_GROUP"
]
},
"externalId": null
},
{
"additionalInfo": {
"layoutX": 319,
"layoutY": 109
},
"type": "org.thingsboard.rule.engine.filter.TbMsgTypeFilterNode",
"name": "Post attributes or RPC request",
"singletonMode": false,
"configurationVersion": 0,
"configuration": {
"messageTypes": [
"POST_ATTRIBUTES_REQUEST",
"RPC_CALL_FROM_SERVER_TO_DEVICE"
]
},
"externalId": null
},
{
"additionalInfo": {
"layoutX": 627,
"layoutY": 108
},
"type": "org.thingsboard.rule.engine.transform.TbDuplicateMsgToGroupNode",
"name": "Duplicate To Group Entities",
"singletonMode": false,
"configurationVersion": 0,
"configuration": {
"entityGroupId": null,
"entityGroupIsMessageOriginator": true
},
"externalId": null
},
{
"additionalInfo": {
"description": "Process incoming messages from devices with the alarm rules defined in the device profile. Dispatch all incoming messages with \"Success\" relation type.",
"layoutX": 45,
"layoutY": 359
},
"type": "org.thingsboard.rule.engine.profile.TbDeviceProfileNode",
"name": "Device Profile Node",
"singletonMode": false,
"configurationVersion": 0,
"configuration": {
"persistAlarmRulesState": false,
"fetchAlarmRulesStateOnStart": false
},
"externalId": null
},
{
"additionalInfo": {
"description": "",
"layoutX": 160,
"layoutY": 631
},
"type": "org.thingsboard.rule.engine.filter.TbJsFilterNode",
"name": "Test JS script",
"singletonMode": false,
"configurationVersion": 0,
"configuration": {
"scriptLang": "JS",
"jsScript": "var test = {\n a: 'a',\n b: 'b'\n};\nreturn test.a === 'a' && test.b === 'b';",
"tbelScript": "return msg.temperature > 20;"
},
"externalId": null
},
{
"additionalInfo": {
"description": "",
"layoutX": 427,
"layoutY": 541
},
"type": "org.thingsboard.rule.engine.filter.TbJsFilterNode",
"name": "Test TBEL script",
"singletonMode": false,
"configurationVersion": 0,
"configuration": {
"scriptLang": "TBEL",
"jsScript": "return msg.temperature > 20;",
"tbelScript": "var a = \"a\";\nvar b = \"b\";\nreturn a.equals(\"a\") && b.equals(\"b\");"
},
"externalId": null
},
{
"additionalInfo": {
"description": "",
"layoutX": 40,
"layoutY": 252
},
"type": "org.thingsboard.rule.engine.transform.TbTransformMsgNode",
"name": "Add arrival timestamp",
"singletonMode": false,
"configurationVersion": 0,
"configuration": {
"scriptLang": "TBEL",
"jsScript": "return {msg: msg, metadata: metadata, msgType: msgType};",
"tbelScript": "metadata.arrivalTs = Date.now();\nreturn {msg: msg, metadata: metadata, msgType: msgType};"
},
"externalId": null
},
{
"additionalInfo": {
"description": "",
"layoutX": 1467,
"layoutY": 267
},
"type": "org.thingsboard.rule.engine.transform.TbTransformMsgNode",
"name": "Calculate additional latencies",
"singletonMode": false,
"configurationVersion": 0,
"configuration": {
"scriptLang": "TBEL",
"jsScript": "return {msg: msg, metadata: metadata, msgType: msgType};",
"tbelScript": "var arrivalLatency = metadata.arrivalTs - metadata.ts;\nvar processingTime = Date.now() - metadata.arrivalTs;\nmsg = {\n arrivalLatency: arrivalLatency,\n processingTime: processingTime\n};\nreturn {msg: msg, metadata: metadata, msgType: msgType};"
},
"externalId": null
},
{
"additionalInfo": {
"description": "",
"layoutX": 1438,
"layoutY": 403
},
"type": "org.thingsboard.rule.engine.transform.TbChangeOriginatorNode",
"name": "To latencies asset",
"singletonMode": false,
"configurationVersion": 0,
"configuration": {
"originatorSource": "ENTITY",
"entityType": "ASSET",
"entityNamePattern": "[Monitoring] Latencies",
"relationsQuery": {
"direction": "FROM",
"maxLevel": 1,
"filters": [
{
"relationType": "Contains",
"entityTypes": []
}
],
"fetchLastLevelOnly": false
}
},
"externalId": null
},
{
"additionalInfo": {
"description": null,
"layoutX": 1458,
"layoutY": 505
},
"type": "org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNode",
"name": "Save Timeseries",
"singletonMode": false,
"configurationVersion": 0,
"configuration": {
"defaultTTL": 0,
"useServerTs": false,
"persistenceSettings": {
"type": "ON_EVERY_MESSAGE"
}
},
"externalId": null
},
{
"additionalInfo": {
"description": "",
"layoutX": 928,
"layoutY": 266
},
"type": "org.thingsboard.rule.engine.filter.TbCheckMessageNode",
"name": "Has testData",
"singletonMode": false,
"configurationVersion": 0,
"configuration": {
"messageNames": [
"testData"
],
"metadataNames": [],
"checkAllKeys": true
},
"externalId": null
},
{
"additionalInfo": {
"description": null,
"layoutX": 1203,
"layoutY": 327
},
"type": "org.thingsboard.rule.engine.telemetry.TbMsgTimeseriesNode",
"name": "Save Timeseries with TTL",
"singletonMode": false,
"configurationVersion": 0,
"configuration": {
"defaultTTL": 180,
"useServerTs": false,
"persistenceSettings": {
"type": "ON_EVERY_MESSAGE"
}
},
"externalId": null
}
],
"connections": [
{
"fromIndex": 2,
"toIndex": 1,
"type": "Post attributes"
},
{
"fromIndex": 2,
"toIndex": 3,
"type": "RPC Request from Device"
},
{
"fromIndex": 2,
"toIndex": 4,
"type": "Other"
},
{
"fromIndex": 2,
"toIndex": 5,
"type": "RPC Request to Device"
},
{
"fromIndex": 2,
"toIndex": 16,
"type": "Post telemetry"
},
{
"fromIndex": 6,
"toIndex": 2,
"type": "False"
},
{
"fromIndex": 6,
"toIndex": 7,
"type": "True"
},
{
"fromIndex": 7,
"toIndex": 2,
"type": "False"
},
{
"fromIndex": 7,
"toIndex": 8,
"type": "True"
},
{
"fromIndex": 8,
"toIndex": 2,
"type": "Success"
},
{
"fromIndex": 9,
"toIndex": 10,
"type": "Success"
},
{
"fromIndex": 10,
"toIndex": 11,
"type": "True"
},
{
"fromIndex": 11,
"toIndex": 6,
"type": "True"
},
{
"fromIndex": 12,
"toIndex": 9,
"type": "Success"
},
{
"fromIndex": 13,
"toIndex": 14,
"type": "Success"
},
{
"fromIndex": 14,
"toIndex": 15,
"type": "Success"
},
{
"fromIndex": 16,
"toIndex": 0,
"type": "False"
},
{
"fromIndex": 16,
"toIndex": 17,
"type": "True"
},
{
"fromIndex": 17,
"toIndex": 13,
"type": "Success"
}
],
"ruleChainConnections": null
}
}