我的抓取间隔和评估间隔相差很远,如下所示(15 秒与 4 米)。当我向端点提供指标时,我发现规则每 4m 评估一次,这是预期的。但是,我不明白的是,它不会评估过去 4 分钟提供的所有指标的规则。我很难理解两个时钟(抓取和评估)的工作原理。此外,与此相关的文档非常稀疏。任何指示都会有很大帮助。我毫不犹豫地将抓取时间和评估时间更改为各 15 秒。但我需要了解将时钟分开的后果。
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 4m # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
- testmanager:9093
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
- …Run Code Online (Sandbox Code Playgroud) 我试图在一个简单的设置中设置警报管理器,它会为收到的每个通知发送一个 Slack 通知。
我希望通过删除 group_by 配置来禁用分组。
问题是,当我一个接一个地发送 2 个警报时,即使警报管理器在我收到 Slack 通知时将 2 个警报显示为“未分组”,我也会收到第一个警报的一条消息,然后是第二条消息,其中 2 个警报被分组。
这是 config.yml
route:
receiver: default-receiver
group_wait: 1s #30s
group_interval: 1s #5m
# repeat_interval: 10m
# group_by: [cluster, alertname]
receivers:
- name: default-receiver
slack_configs:
- channel: "#alerts-test"
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
我正在使用 Promtail + Loki 来收集我的日志,但我不知道如何对日志文件中的每个错误发出警报。我也在使用 Prometheus、Alertmanager 和 Grafana。我看到有些人已经成功地做到了这一点,但他们都没有解释细节。需要明确的是,我不是在寻找处于 FIRING 状态的警报或具有“警报”状态的 Grafana 仪表板。我所需要的就是每次在我的一个日志中出现错误时都知道。如果不能完全以这种方式完成,下一个最佳解决方案是每 X 秒抓取一次,然后发出类似“6 条新错误消息”的警报。
我在 AWS 上设置了 kubernetes 集群,我尝试使用 cAdvisor + Prometheus + Alert manager 来监控多个 pod。如果容器 / pod 出现故障或卡在 Error 或 CarshLoopBackOff 状态或除了运行之外的任何其他状态,我想要做的是启动电子邮件警报(带有服务/容器名称)。
我正在使用 vanilla Docker 容器来启动 Alertmanager。据我所知,在这种情况下,我无法通过参数提供外部 URL,所以我必须找到另一种方式。
是否可以通过配置文件或环境变量设置 URL?
我在Centos上配置了prometheus,版本详情如下。
prometheus-2.5.0.linux-386
Run Code Online (Sandbox Code Playgroud)
我在 prometheus.yml 配置文件中添加了两个目标,所有服务器节点导出器都在运行。配置如下,
scrape_configs:
- job_name: "node"
scrape_interval: "15s"
target_groups:
- targets: ['192.168.x.x:9100','192.168.x.y:9100']
Run Code Online (Sandbox Code Playgroud)
但是在 prometheus UI Tragets 中只显示单个节点其他没有显示。如果我删除一个节点,则显示现有节点。如何监控多个节点。但是在 Grafana 仪表板中显示Multiple Series Error。
match:
[ <labelname>: <labelvalue>, ... ]
# A set of regex-matchers an alert has to fulfill to match the node.
match_re:
[ <labelname>: <regex>, ... ]
Run Code Online (Sandbox Code Playgroud)
我的问题是 match 和 match_re 语句有什么区别?prometheus里面的两个我都用过,效果是一样的。
很感谢任何形式的帮助!!
我们希望从 Prometheus 服务器获取按特定标签过滤的所有指标名称。
第 1 步:使用以下查询获取所有指标名称,查询成功并获得所有指标名称。
curl -g 'http://localhost:9090/api/v1/label/__name__/values
Run Code Online (Sandbox Code Playgroud)
步骤 2 :使用以下查询获取按标签过滤的所有指标名称,但查询仍然返回所有指标名称。
curl -g 'http://localhost:9090/api/v1/label/__name__/values?match[]={job!="prometheus"}'
Run Code Online (Sandbox Code Playgroud)
有人可以帮我通过 http 按标签过滤所有指标名称吗?谢谢
curl -G -XGET http://localhost:9090/api/v1/label/__name__/values --data-urlencode 'match[]={__name__=~".+", job!="prometheus"}'
Run Code Online (Sandbox Code Playgroud)
@anemyte,仍然返回所有结果。您可以检查一下查询吗
rest curl prometheus prometheus-alertmanager prometheus-java
我在使用配置监控模块时收到警报prometheus/kube-prometheus-stack 25.1.0。
警报
\n[FIRING:1] KubeProxyDown - critical\nAlert: Target disappeared from Prometheus target discovery. - critical\n Description: KubeProxy has disappeared from Prometheus target discovery.\n Details:\n \xe2\x80\xa2 alertname: KubeProxyDown\n \xe2\x80\xa2 prometheus: monitoring/prometheus-kube-prometheus-prometheus\n \xe2\x80\xa2 severity: critical\nRun Code Online (Sandbox Code Playgroud)\n我认为这是一个新的默认规则kube-prometheus-stack 25.x.x。它不存在于prometheus/kube-prometheus-stack 21.x.x.
EKS 和 minikube 中也发生了同样的问题。
\nKubeProxyDown规则
\nalert: KubeProxyDown\nexpr: absent(up{job="kube-proxy"}\n == 1)\nfor: 15m\nlabels:\n severity: critical\nannotations:\n description: KubeProxy has disappeared from Prometheus target discovery.\n runbook_url: https://runbooks.prometheus-operator.dev/runbooks/kubernetes/kubeproxydown\n summary: Target disappeared from Prometheus target discovery.\nRun Code Online (Sandbox Code Playgroud)\n … 我正在从 Helm Chart 部署一个监控堆栈kube-prometheus-stack,并尝试配置 Alertmanager,以便它具有我的自定义配置,用于在 Slack 通道中发出警报。
Pod 中的配置是从 加载的/etc/alertmanager/config/alertmanager.yaml。从 Pod 描述来看,该文件是从自动生成的 Secret 中加载的:
...
volumeMounts:
- mountPath: /etc/alertmanager/config
name: config-volume
...
volumes:
- name: config-volume
secret:
defaultMode: 420
secretName: alertmanager-prometheus-community-kube-alertmanager-generated
Run Code Online (Sandbox Code Playgroud)
如果我检查秘密,它包含在默认值中找到的默认配置alertmanager.config,我打算覆盖它。
如果我将以下配置传递给alertmanager以全新安装图表,它不会创建alertmanager pod:
alertmanager:
config:
global:
resolve_timeout: 5m
route:
group_by: ['job', 'alertname', 'priority']
group_wait: 10s
group_interval: 1m
routes:
- match:
alertname: Watchdog
receiver: 'null'
- receiver: 'slack-notifications'
continue: true
receivers:
- name: 'slack-notifications'
slack-configs:
- slack_api_url: <url here>
title: '{{ .Status }} ({{ …Run Code Online (Sandbox Code Playgroud) kubernetes kubernetes-helm prometheus-alertmanager kube-prometheus-stack