首页 > 其他分享 >Loki not alerting Alertmanager

Loki not alerting Alertmanager

时间:2023-08-12 17:24:17浏览次数:45  
标签:info Alertmanager rules ruler alerting Loki etc loki alertmanager

4

I got it working atlast .

Below is my ruler config

ruler:
  storage:
    type: local
    local:
      directory: /etc/loki/rulestorage
  rule_path: /etc/loki/rules
  alertmanager_url: http://alertmanager:9093
  ring:
    kvstore:
      store: inmemory
  enable_api: true
  enable_alertmanager_v2: true

Created below directories

  • /etc/loki/rulestorage/fake
  • /etc/loki/rules/fake
  • Copied alert_rules.yaml under /etc/loki/rulestorage/fake
  • Gave full permission for loki user under /etc/loki/rulestorage/fake

 

1

The config looks good, similar as mine. I would troubleshoot it with following steps:

  1. Exec to docker container and check if the rules file is not empty cat /etc/loki/rules/rules.yaml

  2. Check the logs of loki. When rules are loaded properly logs like this will pop up:

level=info ts=2021-05-06T11:18:33.355446729Z caller=module_service.go:58 msg=initialising module=ruler
level=info ts=2021-05-06T11:18:33.355538059Z caller=ruler.go:400 msg="ruler up and running"
level=info ts=2021-05-06T11:18:33.356584674Z caller=mapper.go:139 msg="updating rule file" file=/data/loki/loki-stack-alerting-rules.yaml
  1. During runtime loki also logs info messages about your rule (I will show you the one I am running, but slightly shortened)(notice status=200 and non-empty bytes=...):
level=info 
ts=... 
caller=metrics.go:83 
org_id=... 
traceID=... 
latency=fast 
query="sum(rate({component=\"kube-apiserver\"} |~ \"stderr F E.*failed calling webhook \\\"webhook.openpolicyagent.org\\\". an error on the server.*has prevented the request from succeeding\"[1m])) > 1" 
query_type=metric 
range_type=instant 
length=0s 
step=0s 
duration=9.028961ms 
status=200 
throughput=40MB 
total_bytes=365kB
  1. Then make sure you can access alertmanager http://171.11.3.160:9093 from loki container without any issues (there can be a networking problem or you have set up basic authentication, etc.).

  2. If the rule you set up (which you can test from grafana explore window) will exceed the threshold you set for 1 minute the alert should show up in alertmanager. It will be most likely ungrouped as you didn't add any labels to it.

标签:info,Alertmanager,rules,ruler,alerting,Loki,etc,loki,alertmanager
From: https://www.cnblogs.com/weifeng1463/p/17625088.html

相关文章

  • 轻量级日志系统Loki--安装配置详细步骤讲解
    Loki对标EFK/ELK,由于其轻量的设计,备受欢迎,Loki相比EFK/ELK,它不对原始日志进行索引,只对日志的标签进行索引,而日志通过压缩进行存储,通常是文件系统存储,所以其操作成本更低,数量级效率更高由于Loki的存储都是基于文件系统的,所以它的日志搜索时基于内容即日志行中的文本,所以它的查询支......
  • Loki+Promtail+Grafana 监控 K8s 日志
    Loki架构:1、loki:服务端,负责存储日志和处理查询2、promtail:采集端,负责采集日志发送给loki3、grafana:负责采集日志的展示创建yml文件cat>loki-rbac.yaml<<EOFapiVersion:v1kind:ServiceAccountmetadata:name:lokinamespace:thanos-monitoringapiVersion:rbac......
  • Autocheck之Loki
    SimpleIOCandYARAScanner文件名IOC正则表达式匹配完整的文件路径/名称Yara规则检查Yara签名匹配文件数据和进程内存哈希检查将已知的恶意哈希(MD5,SHA1,SHA256)与扫描的文件进行比较C2连接后检查将进程连接端点与C2IOC进行比较(版本v.10后新增)需要文件下loki最新发布版:ht......
  • cenots7安装Loki+promtail+grafana
    loki是主服务器,负责存储日志和处理查询promtail是代理,负责收集日志并将其发送给loki Grafana用于UI展示1、官方网站上下载对应的loki和promatail版本包https://github.com/grafana/loki/releases/打开链接后,往下翻 点击Showall56assets后,往下翻,找到对应你操作系统......
  • Kubernetes轻量级日志工具Loki安装及踩坑记录
    Loki简介Loki是Grafana出品的一个轻量级日志系统,熟悉ELK的都知道ELK使用起来的成本,而且仅仅是日志检索使用ELK的话有点大材小用了。Loki8技术栈中使用了以下组件。Promtail用来将容器日志发送到Loki或者Grafana服务上的日志收集工具,该工具主要包括发现采集目标以及给日志......
  • Prometheus+alertmanager实现告警的简单验证
    Prometheus+alertmanager实现告警的简单验证背景学习源自:http://www.mydlq.club/article/126/上午没搞定,中午睡不着,继续学习处理.发现最恶心的有点事alertmanager的--cluster.listen-address--web.listen-address两个参数很多资料里面只写了第一个参数,没写第......
  • k3s 基础 —— 配置 loki
    官方文档核心组件3个chart:promtail这是一个agent代理客户端,用于收集日志,将日志传送给lokiloki核心组件,主要功能是日志数据的写入与分析。包含gateway、read、write3个组件。kube-prometheus-stack这个技术栈包含prometheus,grafana,prometheusoperator等组件。p......
  • alertmanager的web页面显示UTC时间的问题
    1.http://192.168.1.144:9093/#/alerts 显示的告警时间是UTC时间2.脚本的变量{"status":"success"}[root@k8selasticsearch]#catvars_config.conf|egrep-v'#'INDEX_FILE="/opt/elasticsearch/indices_file.txt"ELASTICSEARCHDUMP_CMD="/......
  • Alertmanager配置详解
    一、 配置概述Alertmanager主要负责对Prometheus产生的告警进行统一处理,在Alertmanager配置中一般会包含以下几个主要部分:全局配置(global):用于定义一些全局的公共参数,如全局的SMTP配置,Slack配置等内容;模板(templates):用于定义告警通知时的模板,如HTML模板,邮件模板等;告警路由(route):根据......
  • Alertmanager钉钉告警
    一.部署alertmanager1.1创建目录mkdir-p/deploy/app/alertmanager/configchmod-R777/deploy/app/alertmanager/config1.2部署alertmanager,也需要个配置文件,先部署临时容器,然后把配置文件复制下来dockerrun-d-p9093:9093--namealertmanagerprom/alertmanagerdo......