-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from thomasjpfan/issue-28
Moves alertIf shortcuts to YAML file and alertIf secrets option
- Loading branch information
Showing
5 changed files
with
279 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
"@service_mem_limit": | ||
expanded: container_memory_usage_bytes{container_label_com_docker_swarm_service_name="{{ .Alert.ServiceName }}"}/container_spec_memory_limit_bytes{container_label_com_docker_swarm_service_name="{{ .Alert.ServiceName }}"} > {{ index .Values 0 }} | ||
annotations: | ||
summary: Memory of the service {{ .Alert.ServiceName }} is over {{ index .Values 0 }} | ||
labels: | ||
receiver: system | ||
service: "{{ .Alert.ServiceName }}" | ||
"@node_mem_limit": | ||
expanded: (sum by (instance) (node_memory_MemTotal{job="{{ .Alert.ServiceName }}"}) - sum by (instance) (node_memory_MemFree{job="{{ .Alert.ServiceName }}"} + node_memory_Buffers{job="{{ .Alert.ServiceName }}"} + node_memory_Cached{job="{{ .Alert.ServiceName }}"})) / sum by (instance) (node_memory_MemTotal{job="{{ .Alert.ServiceName }}"}) > {{ index .Values 0 }} | ||
annotations: | ||
summary: Memory of a node is over {{ index .Values 0 }} | ||
labels: | ||
receiver: system | ||
service: "{{ .Alert.ServiceName }}" | ||
"@node_mem_limit_total_above": | ||
expanded: (sum(node_memory_MemTotal{job="{{ .Alert.ServiceName }}"}) - sum(node_memory_MemFree{job="{{ .Alert.ServiceName }}"} + node_memory_Buffers{job="{{ .Alert.ServiceName }}"} + node_memory_Cached{job="{{ .Alert.ServiceName }}"})) / sum(node_memory_MemTotal{job="{{ .Alert.ServiceName }}"}) > {{ index .Values 0 }} | ||
annotations: | ||
summary: Total memory of the nodes is over {{ index .Values 0 }} | ||
labels: | ||
receiver: system | ||
service: "{{ .Alert.ServiceName }}" | ||
scale: up | ||
type: node | ||
"@node_mem_limit_total_below": | ||
expanded: (sum(node_memory_MemTotal{job="{{ .Alert.ServiceName }}"}) - sum(node_memory_MemFree{job="{{ .Alert.ServiceName }}"} + node_memory_Buffers{job="{{ .Alert.ServiceName }}"} + node_memory_Cached{job="{{ .Alert.ServiceName }}"})) / sum(node_memory_MemTotal{job="{{ .Alert.ServiceName }}"}) < {{ index .Values 0 }} | ||
annotations: | ||
summary: Total memory of the nodes is below {{ index .Values 0 }} | ||
labels: | ||
receiver: system | ||
service: "{{ .Alert.ServiceName }}" | ||
scale: "down" | ||
type: node | ||
"@node_fs_limit": | ||
expanded: (node_filesystem_size{fstype="aufs", job="{{ .Alert.ServiceName }}"} - node_filesystem_free{fstype="aufs", job="{{ .Alert.ServiceName }}"}) / node_filesystem_size{fstype="aufs", job="{{ .Alert.ServiceName }}"} > {{ index .Values 0 }} | ||
annotations: | ||
summary: Disk usage of a node is over {{ index .Values 0 }} | ||
labels: | ||
receiver: system | ||
service: "{{ .Alert.ServiceName }}" | ||
"@resp_time_above": | ||
expanded: sum(rate(http_server_resp_time_bucket{job="{{ .Alert.ServiceName }}", le="{{ index .Values 0 }}"}[{{ index .Values 1 }}])) / sum(rate(http_server_resp_time_count{job="{{ .Alert.ServiceName }}"}[{{ index .Values 1 }}])) < {{ index .Values 2 }} | ||
annotations: | ||
summary: Response time of the service {{ .Alert.ServiceName }} is above {{ index .Values 0 }} | ||
labels: | ||
receiver: system | ||
service: "{{ .Alert.ServiceName }}" | ||
scale: up | ||
type: service | ||
"@resp_time_below": | ||
expanded: sum(rate(http_server_resp_time_bucket{job="{{ .Alert.ServiceName }}", le="{{ index .Values 0 }}"}[{{ index .Values 1 }}])) / sum(rate(http_server_resp_time_count{job="{{ .Alert.ServiceName }}"}[{{ index .Values 1 }}])) > {{ index .Values 2 }} | ||
annotations: | ||
summary: Response time of the service {{ .Alert.ServiceName }} is below {{ index .Values 0 }} | ||
labels: | ||
receiver: system | ||
service: "{{ .Alert.ServiceName }}" | ||
scale: down | ||
type: service | ||
"@replicas_running": | ||
expanded: count(container_memory_usage_bytes{container_label_com_docker_swarm_service_name="{{ .Alert.ServiceName }}"}) != {{ .Alert.Replicas }} | ||
annotations: | ||
summary: The number of running replicas of the service {{ .Alert.ServiceName }} is not {{ .Alert.Replicas }} | ||
labels: | ||
receiver: system | ||
service: "{{ .Alert.ServiceName }}" | ||
scale: up | ||
type: node | ||
"@replicas_less_than": | ||
expanded: count(container_memory_usage_bytes{container_label_com_docker_swarm_service_name="{{ .Alert.ServiceName }}"}) < {{ .Alert.Replicas }} | ||
annotations: | ||
summary: The number of running replicas of the service {{ .Alert.ServiceName }} is less than {{ .Alert.Replicas }} | ||
labels: | ||
receiver: system | ||
service: "{{ .Alert.ServiceName }}" | ||
scale: up | ||
type: node | ||
"@replicas_more_than": | ||
expanded: count(container_memory_usage_bytes{container_label_com_docker_swarm_service_name="{{ .Alert.ServiceName }}"}) > {{ .Alert.Replicas }} | ||
annotations: | ||
summary: The number of running replicas of the service {{ .Alert.ServiceName }} is more than {{ .Alert.Replicas }} | ||
labels: | ||
receiver: system | ||
service: "{{ .Alert.ServiceName }}" | ||
scale: up | ||
type: node | ||
"@resp_time_server_error": | ||
expanded: sum(rate(http_server_resp_time_count{job="{{ .Alert.ServiceName }}", code=~"^5..$$"}[{{ index .Values 0 }}])) / sum(rate(http_server_resp_time_count{job="{{ .Alert.ServiceName }}"}[{{ index .Values 0 }}])) > {{ index .Values 1 }} | ||
annotations: | ||
summary: Error rate of the service {{ .Alert.ServiceName }} is above {{ index .Values 1 }} | ||
labels: | ||
receiver: system | ||
service: "{{ .Alert.ServiceName }}" | ||
type: errors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.