Create custom checks

    Using a Flux task, you can create a custom check that provides a couple advantages:

    • Customize and transform the data you would like to use for the check.
    1. In the InfluxDB UI, select Tasks in the navigation menu on the left.

    2. Click Create Task.

    3. In the Name field, enter a descriptive name, and then enter how often to run the task in the Every field (for example, 10m). For more detail, such as using cron syntax or including an offset, see Task configuration options.

    Use the to see the Flux code for a check built in the UI. This can be useful for constructing custom checks.

    The script below is fairly complex, and can be used as a framework for similar tasks. It does the following:

    • Query the _tasks bucket to retrieve all statuses generated by your check.
    • Set the to alert on, for example, crit, warn, info, or ok.
    • Create a object that specifies an ID, name, and type for the check.
    • Define the ok and crit statuses.

    Example alert task script