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,
)
此页面对您有帮助吗?
感谢您的反馈!