Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apis/monitoring/v1alpha1/cluster_alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ type ClusterAlertSpec struct {

// Vars contains Icinga Service variables to be used in CheckCommand
Vars map[string]string `json:"vars,omitempty"`

// Indicates that Check is paused
// Icinga Services are removed
Paused bool `json:"paused,omitempty"`
}

var _ Alert = &ClusterAlert{}
Expand Down
4 changes: 4 additions & 0 deletions apis/monitoring/v1alpha1/node_alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ type NodeAlertSpec struct {

// Vars contains Icinga Service variables to be used in CheckCommand
Vars map[string]string `json:"vars,omitempty"`

// Indicates that Check is paused
// Icinga Services are removed
Paused bool `json:"paused,omitempty"`
}

var _ Alert = &NodeAlert{}
Expand Down
4 changes: 4 additions & 0 deletions apis/monitoring/v1alpha1/pod_alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ type PodAlertSpec struct {

// Vars contains Icinga Service variables to be used in CheckCommand
Vars map[string]string `json:"vars,omitempty"`

// Indicates that Check is paused
// Icinga Services are removed
Paused bool `json:"paused,omitempty"`
}

var _ Alert = &PodAlert{}
Expand Down
9 changes: 9 additions & 0 deletions pkg/icinga/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ func (h *ClusterHost) Apply(alert *api.ClusterAlert) error {
return err
}

if alertSpec.Paused {
if has {
if err := h.DeleteIcingaService(alert.Name, kh); err != nil {
return err
}
}
return nil
}

attrs := make(map[string]interface{})
if alertSpec.CheckInterval.Seconds() > 0 {
attrs["check_interval"] = alertSpec.CheckInterval.Seconds()
Expand Down
9 changes: 9 additions & 0 deletions pkg/icinga/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ func (h *NodeHost) Apply(alert *api.NodeAlert, node *core.Node) error {
return err
}

if alertSpec.Paused {
if has {
if err := h.DeleteIcingaService(alert.Name, kh); err != nil {
return err
}
}
return nil
}

attrs := make(map[string]interface{})
if alertSpec.CheckInterval.Seconds() > 0 {
attrs["check_interval"] = alertSpec.CheckInterval.Seconds()
Expand Down
9 changes: 9 additions & 0 deletions pkg/icinga/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ func (h *PodHost) Apply(alert *api.PodAlert, pod *core.Pod) error {
return err
}

if alertSpec.Paused {
if has {
if err := h.DeleteIcingaService(alert.Name, kh); err != nil {
return err
}
}
return nil
}

attrs := make(map[string]interface{})
if alertSpec.CheckInterval.Seconds() > 0 {
attrs["check_interval"] = alertSpec.CheckInterval.Seconds()
Expand Down