文档文档

tickscript.deadman() 函数

tickscript.deadman() 是一个用户贡献的函数,由包作者维护。

tickscript.deadman() 检测低数据吞吐量,并将具有严重状态的点写入 InfluxDB _monitoring 系统 bucket。

对于每个输入表,如果包含的行数小于或等于指定的阈值,则该函数会将 crit 值分配给 _level 列。

此函数与 Kapacitor AlertNode deadman 类似。

函数类型签名
(
    <-tables: stream[M],
    check: {A with tags: E, _type: D, _check_name: C, _check_id: B},
    measurement: string,
    ?id: (r: {F with _check_name: C, _check_id: B}) => G,
    ?message: (
        r: {
            H with
            dead: bool,
            _type: D,
            _time: J,
            _time: time,
            _source_timestamp: int,
            _source_measurement: I,
            _measurement: I,
            _measurement: string,
            _level: string,
            _check_name: C,
            _check_id: B,
        },
    ) => K,
    ?threshold: L,
    ?topic: string,
) => stream[{
    H with
    dead: bool,
    _type: D,
    _time: J,
    _time: time,
    _source_timestamp: int,
    _source_measurement: I,
    _message: K,
    _measurement: I,
    _measurement: string,
    _level: string,
    _check_name: C,
    _check_id: B,
}] where E: Record, F: Record, L: Comparable + Equatable, M: Record

有关更多信息,请参阅 函数类型签名

参数

check

(必需) InfluxDB check 数据。请参阅 tickscript.defineCheck()

measurement

(必需) Measurement 名称。应与查询的 measurement 匹配。

threshold

计数阈值。默认为 0

对于行数小于或等于阈值的输入表,该函数会分配 crit 状态。

id

返回 check 记录提供的 InfluxDB check ID 的函数。默认为 (r) => "${r._check_id}"

message

返回使用输入行数据的 InfluxDB check 消息的函数。默认为 (r) => "Deadman Check: ${r._check_name} is: " + (if r.dead then "dead" else "alive")

topic

Check topic。默认为 ""

tables

输入数据。默认为管道转发数据 (<-)。

示例

检测序列何时停止报告

import "contrib/bonitoo-io/tickscript"

option task = {name: "Example task", every: 1m}

from(bucket: "example-bucket")
    |> range(start: -task.every)
    |> filter(fn: (r) => r._measurement == "pulse" and r._field == "value")
    |> tickscript.deadman(
        check: tickscript.defineCheck(id: "000000000000", name: "task/${r.service}"),
        measurement: "pulse",
        threshold: 2,
    )

此页面对您有帮助吗?

感谢您的反馈!


Flux 的未来

Flux 即将进入维护模式。您可以继续像现在一样使用它,而无需对代码进行任何更改。

阅读更多

现已全面上市

InfluxDB 3 Core 和 Enterprise

快速启动。更快扩展。

获取更新

InfluxDB 3 Core 是一个开源、高速的近数据引擎,可实时收集和处理数据,并将其持久化到本地磁盘或对象存储。InfluxDB 3 Enterprise 构建于 Core 的基础上,增加了高可用性、读取副本、增强的安全性以及数据压缩,以实现更快的查询和优化的存储。InfluxDB 3 Enterprise 的免费层可供非商业家庭或业余爱好者使用。

有关更多信息,请查看