forked from CCCHH/ansible-infra
		
	
		
			
				
	
	
		
			44 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			Cheetah
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			Cheetah
		
	
	
	
	
	
| {{/*
 | |
| Links & Resources
 | |
| - https://prometheus.io/blog/2016/03/03/custom-alertmanager-templates/
 | |
| - https://prometheus.io/docs/alerting/latest/notifications/
 | |
| - https://gist.github.com/jidckii/5ac5f8f20368b56de72af70222509b7b
 | |
| */}}
 | |
| {{ define "alert-item.telegram.ccchh.internal" }}
 | |
| <b>[{{ .Labels.alertname }}] {{ .Labels.nodename }}</b>
 | |
| {{- if .Annotations.summary }}
 | |
| <i>Summary</i>: {{ .Annotations.summary }}
 | |
| {{- end }}
 | |
| {{- if .Annotations.description }}
 | |
| <i>Description</i>: {{ .Annotations.description }}
 | |
| {{- end }}
 | |
| <i>Labels</i>:
 | |
| {{ range .Labels.SortedPairs -}}
 | |
| • <i>{{ .Name }}</i>: <code>{{ .Value }}</code>
 | |
| {{ end }}
 | |
| {{- end }}
 | |
| 
 | |
| 
 | |
| {{ define "alert-message.telegram.ccchh" }}
 | |
|   {{- if .Alerts.Firing }}
 | |
|     <u>🔥{{ len .Alerts.Firing }} Alert(/s) Firing 🔥</u>
 | |
|     {{- if le (len .Alerts.Firing) 5 }}
 | |
|       {{- range .Alerts.Firing }}
 | |
|         {{ template "alert-item.telegram.ccchh.internal" . }}
 | |
|       {{- end }}
 | |
|     {{- else }}
 | |
|       There are too many alerts firing at once
 | |
|     {{- end }}
 | |
|   {{- end }}
 | |
| 
 | |
|   {{- if .Alerts.Resolved }}
 | |
|     <u>✅{{ len .Alerts.Resolved }} Alert(/s) Resolved ✅</u>
 | |
|     {{- if le (len .Alerts.Resolved) 5 }}
 | |
|       {{- range .Alerts.Resolved }}
 | |
|         {{ template "alert-item.telegram.ccchh.internal" . }}
 | |
|       {{- end }}
 | |
|     {{- else }}
 | |
|       There are too many resolved alerts to list
 | |
|     {{- end }}
 | |
|   {{- end }}
 | |
| {{- end }}
 |