Save data to OpenTSDB

    Create a rule:

    Go to EMQX Dashboard (opens new window), select the “rule” tab on the menu to the left.

    Select “message.publish”, then type in the following SQL:

    image

    Bind an action:

    Click on the “+ Add” button under “Action Handler”, and then select “Data to OpenTSDB” in the pop-up dialog window.

    Fill in the parameters required by the action:

    Six parameters is required by action “Data to OpenTSDB”:

    2). Summary. Whether let OpenTSDB Server return data point success/failure count, defaults to true.

    3). Max Batch Size. In case of heavy traffic, how many data points are allowed to be included in a single request. Default to 20.

    4). Sync Call. Defaults to false.

    5). Sync Timeout. Defaults to 0.

    image

    6). Bind a resource to the action. Since the dropdown list “Resource” is empty for now, we create a new resource by clicking on the “New Resource” to the top right, and then select “OpenTSDB”:

    Configure the resource:

    Keep all the default configs as default, and click on the “Testing Connection” button to make sure the connection can be created successfully, and then click on the “Create” button.

    Back to the “Actions” dialog, and then click on the “Confirm” button.

    image

    Back to the creating rule page, then click on “Create” button. The rule we created will be show in the rule list:

    We have finished, testing the rule by sending an MQTT message to emqx:

    Then inspect the OpenTSDB table, verify a new record has been inserted:

    The response should look like following:

    And from the rule list, verify that the “Matched” column has increased to 1:

    image