Skip to content

Commit

Permalink
Replace label for cluster name with clusterName property
Browse files Browse the repository at this point in the history
  • Loading branch information
Sohamdg081992 committed Sep 29, 2023
1 parent d01e8a3 commit f599e2b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 40 deletions.
2 changes: 1 addition & 1 deletion internal/alerts/cluster-scopes.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Here are the cluster parameters which need to be updated in example-alert-template.json before deploying the alerts templates for each cluster. Please
update the "scopes" field in the alerts template with the cluster id and AMW id from the list below depending on the cluster.
Update the labels field with the cluster name below. Update the location according to the cluster. Update the alert name accordingly.
Update the clusterName field with the cluster name below. Update the location according to the cluster. Update the alert name accordingly.

Cluster name Cluster id

Expand Down
41 changes: 2 additions & 39 deletions internal/alerts/example-alert-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@
"/subscriptions/9b96ebbd-c57a-42d1-bbe9-b69296e4c7fb/resourceGroups/ci-dev-aks-mac-eus-rg/providers/microsoft.monitor/accounts/ci-dev-aks-eus-mac",
"/subscriptions/9b96ebbd-c57a-42d1-bbe9-b69296e4c7fb/resourceGroups/ci-dev-aks-mac-eus-rg/providers/Microsoft.ContainerService/managedClusters/ci-dev-aks-mac-eus"
],
"enabled": true,
"clusterName": "ci-dev-aks-mac-eus",
"rules": [
{
"alert": "Amd64 metric missing in cluster ci-dev-aks-mac-eus",
"expression": "absent(node_uname_info{machine=\"x86_64\"}) == 1 or node_uname_info{machine=\"x86_64\"} == 0",
"for": "PT3M",
"labels": {
"cluster": "ci-dev-aks-mac-eus"
},
"annotations": {
"description": "Amd64 metric missing in cluster ci-dev-aks-mac-eus"
},
Expand All @@ -41,9 +40,6 @@
"alert": "up metric missing for target = node in cluster ci-dev-aks-mac-eus",
"expression": "absent(up{job=\"node\"}) == 1 or up{job=\"node\"} == 0",
"for": "PT3M",
"labels": {
"cluster": "ci-dev-aks-mac-eus"
},
"annotations": {
"description": "up metric is not flowing for target = node in cluster ci-dev-aks-mac-eus"
},
Expand All @@ -62,9 +58,6 @@
"alert": "up metric missing for target = kubelet in cluster ci-dev-aks-mac-eus",
"expression": "absent(up{job=\"kubelet\"}) == 1 or up{job=\"kubelet\"} == 0",
"for": "PT3M",
"labels": {
"cluster": "ci-dev-aks-mac-eus"
},
"annotations": {
"description": "up metric is not flowing for target = kubelet in cluster ci-dev-aks-mac-eus"
},
Expand All @@ -83,9 +76,6 @@
"alert": "up metric missing for target = windows-exporter in cluster ci-dev-aks-mac-eus",
"expression": "absent(up{job=\"windows-exporter\"}) == 1 or up{job=\"windows-exporter\"} == 0",
"for": "PT3M",
"labels": {
"cluster": "ci-dev-aks-mac-eus"
},
"annotations": {
"description": "up metric is not flowing for target = windows-exporter in cluster ci-dev-aks-mac-eus"
},
Expand All @@ -104,9 +94,6 @@
"alert": "up metric missing for target = kube-proxy in cluster ci-dev-aks-mac-eus",
"expression": "absent(up{job=\"kube-proxy\"}) == 1 or up{job=\"kube-proxy\"} == 0",
"for": "PT3M",
"labels": {
"cluster": "ci-dev-aks-mac-eus"
},
"annotations": {
"description": "up metric is not flowing for target = kube-proxy in cluster ci-dev-aks-mac-eus"
},
Expand All @@ -125,9 +112,6 @@
"alert": "up metric missing for target = kube-apiserver in cluster ci-dev-aks-mac-eus",
"expression": "absent(up{job=\"kube-apiserver\"}) == 1 or up{job=\"kube-apiserver\"} == 0",
"for": "PT3M",
"labels": {
"cluster": "ci-dev-aks-mac-eus"
},
"annotations": {
"description": "up metric is not flowing for target = kube-apiserver in cluster ci-dev-aks-mac-eus"
},
Expand All @@ -146,9 +130,6 @@
"alert": "up metric missing for target = kube-proxy-windows in cluster ci-dev-aks-mac-eus",
"expression": "absent(up{job=\"kube-proxy-windows\"}) == 1 or up{job=\"kube-proxy-windows\"} == 0",
"for": "PT3M",
"labels": {
"cluster": "ci-dev-aks-mac-eus"
},
"annotations": {
"description": "up metric is not flowing for target = kube-proxy-windows in cluster ci-dev-aks-mac-eus"
},
Expand All @@ -167,9 +148,6 @@
"alert": "up metric missing for target = kube-state-metrics in cluster ci-dev-aks-mac-eus",
"expression": "absent(up{job=\"kube-state-metrics\"}) == 1 or up{job=\"kube-state-metrics\"} == 0",
"for": "PT3M",
"labels": {
"cluster": "ci-dev-aks-mac-eus"
},
"annotations": {
"description": "up metric is not flowing for target = kube-state-metrics in cluster ci-dev-aks-mac-eus"
},
Expand All @@ -188,9 +166,6 @@
"alert": "up metric missing for target = cadvisor in cluster ci-dev-aks-mac-eus",
"expression": "absent(up{job=\"cadvisor\"}) == 1 or up{job=\"cadvisor\"} == 0",
"for": "PT3M",
"labels": {
"cluster": "ci-dev-aks-mac-eus"
},
"annotations": {
"description": "up metric is not flowing for target = cadvisor in cluster ci-dev-aks-mac-eus"
},
Expand All @@ -209,9 +184,6 @@
"alert": "up metric missing for target = kube-dns in cluster ci-dev-aks-mac-eus",
"expression": "absent(up{job=\"kube-dns\"}) == 1 or up{job=\"kube-dns\"} == 0",
"for": "PT3M",
"labels": {
"cluster": "ci-dev-aks-mac-eus"
},
"annotations": {
"description": "up metric is not flowing for target = kube-dns in cluster ci-dev-aks-mac-eus"
},
Expand All @@ -230,9 +202,6 @@
"alert": "CPU usage % greater than 90 for prometheus-collector containers on cluster ci-dev-aks-mac-eus",
"expression": "sum(sum by (cluster, namespace, pod, container) ( rate(container_cpu_usage_seconds_total{job=\"cadvisor\", image!=\"\", namespace=\"kube-system\", container=\"prometheus-collector\"}[5m]) ) * on (cluster, namespace, pod) group_left(node) topk by (cluster, namespace, pod) ( 1, max by(cluster, namespace, pod, node) (kube_pod_info{node!=\"\", namespace=\"kube-system\"}) )) by (container, pod) > 0.9",
"for": "PT3M",
"labels": {
"cluster": "ci-dev-aks-mac-eus"
},
"annotations": {
"description": "CPU usage greater than 90% for prometheus-collector on cluster ci-dev-aks-mac-eus"
},
Expand All @@ -251,9 +220,6 @@
"alert": "CPU usage % greater than 50 for prometheus-collector containers on cluster ci-dev-aks-mac-eus",
"expression": "sum(sum by (cluster, namespace, pod, container) ( rate(container_cpu_usage_seconds_total{job=\"cadvisor\", image!=\"\", namespace=\"kube-system\", container=\"prometheus-collector\"}[5m]) ) * on (cluster, namespace, pod) group_left(node) topk by (cluster, namespace, pod) ( 1, max by(cluster, namespace, pod, node) (kube_pod_info{node!=\"\", namespace=\"kube-system\"}) )) by (container, pod) > 0.5",
"for": "PT3M",
"labels": {
"cluster": "ci-dev-aks-mac-eus"
},
"annotations": {
"description": "CPU usage greater than 5% for prometheus-collector on cluster ci-dev-aks-mac-eus"
},
Expand All @@ -272,9 +238,6 @@
"alert": "Memory usage is high for prometheus-collector containers on cluster ci-dev-aks-mac-eus",
"expression": "(sum(container_memory_working_set_bytes{namespace=\"kube-system\", container=\"prometheus-collector\", image!=\"\"}) by (container, pod) / sum(kube_pod_container_resource_requests{namespace=\"kube-system\", container=\"prometheus-collector\", resource=\"memory\"}) by (container, pod)) > 1.9",
"for": "PT3M",
"labels": {
"cluster": "ci-dev-aks-mac-eus"
},
"annotations": {
"description": "Memory usage is high for prometheus-collector containers on cluster ci-dev-aks-mac-eus"
},
Expand Down

0 comments on commit f599e2b

Please sign in to comment.