emqx_rule_data.json 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. {
  2. "data":[
  3. {
  4. "rawsql":"SELECT\n reason,\n clientid,\n username,\n peername,\n socketname\nFROM\n \"$events/client_connected\"",
  5. "on_action_failed":"continue",
  6. "metrics":[
  7. {
  8. "speed_max":0,
  9. "speed_last5m":0,
  10. "speed":0,
  11. "passed":0,
  12. "node":"emqx@127.0.0.1",
  13. "no_result":0,
  14. "matched":0,
  15. "failed":0,
  16. "exception":0
  17. }
  18. ],
  19. "id":"rule:012980",
  20. "for":[
  21. "$events/client_connected"
  22. ],
  23. "enabled":true,
  24. "description":" 连接",
  25. "actions":[
  26. {
  27. "params":{
  28. "target_topic":"/sys/client/connected",
  29. "target_qos":1,
  30. "payload_tmpl":"{\"reason\":\"${reason}\",\"clientid\":\"${clientid}\",\"username\":\"${username}\",\"peername\":\"${peername}\",\"socketname\":\"${socketname}\"}"
  31. },
  32. "name":"republish",
  33. "metrics":[
  34. {
  35. "taken":0,
  36. "success":0,
  37. "node":"emqx@127.0.0.1",
  38. "failed":0
  39. }
  40. ],
  41. "id":"republish_16528854106752092",
  42. "fallbacks":[
  43. ]
  44. }
  45. ]
  46. },
  47. {
  48. "rawsql":"SELECT\n reason,\n clientid,\n username,\n peername,\n socketname\nFROM\n \"$events/client_disconnected\"",
  49. "on_action_failed":"continue",
  50. "metrics":[
  51. {
  52. "speed_max":0,
  53. "speed_last5m":0,
  54. "speed":0,
  55. "passed":0,
  56. "node":"emqx@127.0.0.1",
  57. "no_result":0,
  58. "matched":0,
  59. "failed":0,
  60. "exception":0
  61. }
  62. ],
  63. "id":"rule:377397",
  64. "for":[
  65. "$events/client_disconnected"
  66. ],
  67. "enabled":true,
  68. "description":"断开连接",
  69. "actions":[
  70. {
  71. "params":{
  72. "target_topic":"/sys/client/disconnected",
  73. "target_qos":0,
  74. "payload_tmpl":"{\"reason\":\"${reason}\",\"clientid\":\"${clientid}\",\"username\":\"${username}\",\"peername\":\"${peername}\",\"socketname\":\"${socketname}\"}"
  75. },
  76. "name":"republish",
  77. "metrics":[
  78. {
  79. "taken":0,
  80. "success":0,
  81. "node":"emqx@127.0.0.1",
  82. "failed":0
  83. }
  84. ],
  85. "id":"republish_16528854190433372",
  86. "fallbacks":[
  87. ]
  88. }
  89. ]
  90. },
  91. {
  92. "rawsql":"SELECT\n clientid,\n username,\n topic,\n qos\nFROM\n \"$events/session_subscribed\"",
  93. "on_action_failed":"continue",
  94. "metrics":[
  95. {
  96. "speed_max":0,
  97. "speed_last5m":0,
  98. "speed":0,
  99. "passed":0,
  100. "node":"emqx@127.0.0.1",
  101. "no_result":0,
  102. "matched":0,
  103. "failed":0,
  104. "exception":0
  105. }
  106. ],
  107. "id":"rule:758695",
  108. "for":[
  109. "$events/session_subscribed"
  110. ],
  111. "enabled":true,
  112. "description":"子设备注册成功后,订阅topic: /sys/{productKey}/{deviceName}/c/#",
  113. "actions":[
  114. {
  115. "params":{
  116. "target_topic":"/sys/session/subscribed",
  117. "target_qos":1,
  118. "payload_tmpl":"{\"username\":\"${username}\",\"topic\":\"${topic}\",\"qos\":\"${qos}\",\"clientid\":\"${clientid}\"}"
  119. },
  120. "name":"republish",
  121. "metrics":[
  122. {
  123. "taken":0,
  124. "success":0,
  125. "node":"emqx@127.0.0.1",
  126. "failed":0
  127. }
  128. ],
  129. "id":"republish_16530236276902029",
  130. "fallbacks":[
  131. ]
  132. }
  133. ]
  134. },
  135. {
  136. "rawsql":"SELECT\n clientid,\n username,\n topic,\n qos\nFROM\n \"$events/session_unsubscribed\"",
  137. "on_action_failed":"continue",
  138. "metrics":[
  139. {
  140. "speed_max":0,
  141. "speed_last5m":0,
  142. "speed":0,
  143. "passed":0,
  144. "node":"emqx@127.0.0.1",
  145. "no_result":0,
  146. "matched":0,
  147. "failed":0,
  148. "exception":0
  149. }
  150. ],
  151. "id":"rule:514503",
  152. "for":[
  153. "$events/session_unsubscribed"
  154. ],
  155. "enabled":true,
  156. "description":"",
  157. "actions":[
  158. {
  159. "params":{
  160. "target_topic":"/sys/session/unsubscribed",
  161. "target_qos":0,
  162. "payload_tmpl":"{\"username\":\"${username}\",\"topic\":\"${topic}\",\"qos\":\"${qos}\",\"clientid\":\"${clientid}\"}"
  163. },
  164. "name":"republish",
  165. "metrics":[
  166. {
  167. "taken":0,
  168. "success":0,
  169. "node":"emqx@127.0.0.1",
  170. "failed":0
  171. }
  172. ],
  173. "id":"republish_16530237303922829",
  174. "fallbacks":[
  175. ]
  176. }
  177. ]
  178. }
  179. ],
  180. "code":0
  181. }