tasks

package
v0.1.45 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDefaultOnClientUUID

func AddDefaultOnClientUUID(uuid string) error

AddDefaultOnClientUUID 在新客户端注册后,把该 UUID 追加到所有 default_on=true 的任务的 clients 中(去重)。

func AddPingTask

func AddPingTask(clients []string, defaultOn bool, name string, target, task_type string, interval int, reference string) (uint, error)

AddPingTask 创建延迟监测任务。defaultOn 表示新加入的服务器是否自动开启此监测。

func ClearTaskResultsByTimeBefore

func ClearTaskResultsByTimeBefore(before time.Time) error

func CreateTask

func CreateTask(taskId string, clients []string, command string) error

func DeleteAllPingRecords

func DeleteAllPingRecords() error

func DeletePingRecords

func DeletePingRecords(id []uint) error

func DeletePingTask

func DeletePingTask(id []uint) error

func EditPingTask

func EditPingTask(tasks []*models.PingTask) error

EditPingTask 批量更新延迟监测任务配置。

func GetAllPingTasks

func GetAllPingTasks() ([]models.PingTask, error)

func GetAllTasks

func GetAllTasks() ([]models.Task, error)

func GetPingRecords

func GetPingRecords(uuid string, taskId int, start, end time.Time) ([]models.PingRecord, error)

func GetPingRecordsBatch added in v0.1.16

func GetPingRecordsBatch(uuids []string, taskId int, start, end time.Time) (map[string][]models.PingRecord, error)

GetPingRecordsBatch 一次查询取回多个节点的 ping 记录(见 metricstore 里的说明)。

func GetPingTasksByClient

func GetPingTasksByClient(uuid string) []models.PingTask

GetPingTasksByClient 获取指定服务器需要执行的延迟监测任务。

func GetSpecificTaskResult

func GetSpecificTaskResult(taskId, clientId string) (*models.TaskResult, error)

func GetTaskByTaskId

func GetTaskByTaskId(taskId string) (*models.Task, error)

func GetTaskResultsByTaskId

func GetTaskResultsByTaskId(taskId string) ([]models.TaskResult, error)

func GetTasksByClientId

func GetTasksByClientId(clientId string) ([]models.Task, error)

func ReloadPingSchedule

func ReloadPingSchedule() error

func SavePingRecord

func SavePingRecord(record models.PingRecord) error

func SaveTaskResult

func SaveTaskResult(taskId, clientId, result string, exitCode int, timestamp time.Time) error

func UpdatePingTaskOrder

func UpdatePingTaskOrder(order map[uint]int) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL