linux - Prometheus alertmanager - 无效的前导 UTF-8 八位字节
问题描述
我正在尝试使用以下 yml配置slack notification
from 。Prometheus alertmanager
global:
resolve_timeout: 1m
slack_api_url: 'https://hooks.slack.com/services/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'
route:
receiver: 'slack-notifications'
receivers:
- name: 'slack-notifications'
slack_configs:
- channel: '#monitoring-instances'
send_resolved: true
icon_url: https://avatars3.githubusercontent.com/u/3380462
title: |-
[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] {{ .CommonLabels.alertname }} for {{ .CommonLabels.job }}
{{- if gt (len .CommonLabels) (len .GroupLabels) -}}
{{" "}}(
{{- with .CommonLabels.Remove .GroupLabels.Names }}
{{- range $index, $label := .SortedPairs -}}
{{ if $index }}, {{ end }}
{{- $label.Name }}="{{ $label.Value -}}"
{{- end }}
{{- end -}}
)
{{- end }}
text: >-
{{ range .Alerts -}}
*Alert:* {{ .Annotations.title }}{{ if .Labels.severity }} - `{{ .Labels.severity }}`{{ end }}
*Description:* {{ .Annotations.description }}
*Details:*
{{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
{{ end }}
{{ end }}
当我启动警报管理器容器时,它会继续重新启动并显示以下错误。
警报管理器 | level=error ts=2021-01-12T04:08:19.040Z caller=coordinator.go:124 component=configuration msg="加载配置文件失败" file=/etc/alertmanager/alertmanager.yml err="yaml: 无效前导UTF-8 八位字节"
已验证这里显示为有效yaml
还检查了记事本++encoding
已经显示为UTF-8
任何其他方法来解决这个问题?
即使此代码也显示相同的错误。
slack_configs:
- channel: '#monitoring-instances'
send_resolved: false
title: '[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ end }}] Monitoring Event Notification'
text: >-
{{ range .Alerts }}
*Alert:* {{ .Annotations.summary }} - `{{ .Labels.severity }}`
*Description:* {{ .Annotations.description }}
*Graph:* <{{ .GeneratorURL }}|:chart_with_upwards_trend:> *Runbook:* <{{ .Annotations.runbook }}|:spiral_note_pad:>
*Details:*
{{ range .Labels.SortedPairs }} • *{{ .Name }}:* `{{ .Value }}`
{{ end }}
{{ end }}
我使用的是 Centos-8.2 系统,是不是我的系统有问题?有谁可以帮我离开这里吗。
解决方案
In my occasion there was an issue with the config/application.yml It was all Gibberish so I had to deleted it and recreate it. After that the issue was resolved.
推荐阅读
- python - 过滤三列值相同的数据
- excel - 具有多个变量标准的自动过滤器
- java - CPLEX 收入最大化
- composite-key - 查找表的复合键
- asp.net-core - `MapControllerRoute`、`MapDefaultControllerRoute`和`MapControllers`之间的区别?
- kotlin - Kotlin:删除数组中相同的相邻成员
- php - 如何为多语言网站设置 .htaccess?
- kubernetes - 如何在 Google Kubernetes Engine 中启用功能门?
- android - 如何在 Android 的原生消息应用程序中添加自定义表情符号库?
- sql-server - 在 SQL Server 中扩展分区函数和方案