triggers config added

This commit is contained in:
sqshq 2019-03-03 14:35:29 -05:00
parent 667d97a4b8
commit 031f8eefa6
2 changed files with 20 additions and 4 deletions

View File

@ -7,10 +7,9 @@ runcharts:
w: 53 w: 53
h: 16 h: 16
scale: 3 scale: 3
alerts: triggers:
- name: PROCESSING STARTED // ${prev} ${cur} ${lavel} // echo $(( 3 < 4 && 1 > 2 )) - title: PROCESSING STARTED # ${prev} ${cur} ${lavel} echo $(( 3 < 4 && 1 > 2 ))
trigger: ((${prev} == 0 && ${cur} > 0)) condition: ((${prev} == 0 && ${cur} > 0))
repeat: false
action: action:
terminal-bell: true terminal-bell: true
sound: false sound: false

View File

@ -13,8 +13,22 @@ type ComponentConfig struct {
Size Size `yaml:"size"` Size Size `yaml:"size"`
} }
type TriggerConfig struct {
Title string `yaml:"title"`
Condition string `yaml:"condition"`
Action *Action `yaml:"action,omitempty"`
}
type Action struct {
TerminalBell *bool `yaml:"terminal-bell,omitempty"`
Sound *bool `yaml:"sound,omitempty"`
Visual *bool `yaml:"visual,omitempty"`
Script *bool `yaml:"script,omitempty"`
}
type GaugeConfig struct { type GaugeConfig struct {
ComponentConfig `yaml:",inline"` ComponentConfig `yaml:",inline"`
TriggerConfig `yaml:",inline"`
Scale *int `yaml:"scale,omitempty"` Scale *int `yaml:"scale,omitempty"`
Color *ui.Color `yaml:"color,omitempty"` Color *ui.Color `yaml:"color,omitempty"`
Values map[string]string `yaml:"values"` Values map[string]string `yaml:"values"`
@ -23,18 +37,21 @@ type GaugeConfig struct {
type BarChartConfig struct { type BarChartConfig struct {
ComponentConfig `yaml:",inline"` ComponentConfig `yaml:",inline"`
TriggerConfig `yaml:",inline"`
Scale *int `yaml:"scale,omitempty"` Scale *int `yaml:"scale,omitempty"`
Items []data.Item `yaml:"items"` Items []data.Item `yaml:"items"`
} }
type AsciiBoxConfig struct { type AsciiBoxConfig struct {
ComponentConfig `yaml:",inline"` ComponentConfig `yaml:",inline"`
TriggerConfig `yaml:",inline"`
data.Item `yaml:",inline"` data.Item `yaml:",inline"`
Font *asciibox.AsciiFont `yaml:"font,omitempty"` Font *asciibox.AsciiFont `yaml:"font,omitempty"`
} }
type RunChartConfig struct { type RunChartConfig struct {
ComponentConfig `yaml:",inline"` ComponentConfig `yaml:",inline"`
TriggerConfig `yaml:",inline"`
Legend *LegendConfig `yaml:"legend,omitempty"` Legend *LegendConfig `yaml:"legend,omitempty"`
Scale *int `yaml:"scale,omitempty"` Scale *int `yaml:"scale,omitempty"`
Items []data.Item `yaml:"items"` Items []data.Item `yaml:"items"`