安装配置 Alertmanager

  1. wget https://github.com/prometheus/alertmanager/releases/download/v0.20.0/alertmanager-0.20.0.linux-amd64.tar.gz
  2. tar -zxv -f alertmanager-0.20.0.linux-amd64.tar.gz -C /usr/local
  3. cd /usr/local
  4. mv alertmanager-0.20.0.linux-amd64/ alertmanager
  5. groupadd prometheus
  6. useradd -g prometheus -m -d /var/lib/prometheus -s /sbin/nologin prometheus
  7. chown -R prometheus.prometheus alertmanager/ # alertmanager.service启动文件中会用到prometheus用户

创建启动文件

Alertmanager 安装目录下默认有 alertmanager.yml 配置文件,可以创建新的配置文件,在启动时指定即可。

  1. vim /usr/lib/systemd/system/alertmanager.service
  2. [Unit]
  3. Description=alertmanager
  4. Documentation=https://github.com/prometheus/alertmanager
  5. After=network.target
  6. [Service]
  7. Type=simple
  8. User=prometheus
  9. ExecStart=/usr/local/alertmanager/alertmanager --config.file=/usr/local/alertmanager/alertmanager.yml --storage.path=/usr/local/alertmanager/data
  10. Restart=on-failure
  11. [Install]
  12. WantedBy=multi-user.target
  1. systemctl daemon-reload
  2. systemctl start alertmanager.service
  3. systemctl status alertmanager.service
  4. systemctl enable alertmanager.service

启动命令参考参数

  1. # ./alertmanager --help
  2. usage: alertmanager [<flags>]
  3. Flags:
  4. -h, --help Show context-sensitive help (also try --help-long and --help-man).
  5. --config.file="alertmanager.yml"
  6. Alertmanager configuration file name.
  7. --storage.path="data/" Base path for data storage.
  8. --data.retention=120h How long to keep data for.
  9. --alerts.gc-interval=30m Interval between alert GC.
  10. --web.config.file="" [EXPERIMENTAL] Path to configuration file that can enable TLS or
  11. authentication.
  12. --web.external-url=WEB.EXTERNAL-URL
  13. The URL under which Alertmanager is externally reachable (for
  14. example, if Alertmanager is served via a reverse proxy). Used for
  15. generating relative and absolute links back to Alertmanager itself.
  16. If the URL has a path portion, it will be used to prefix all HTTP
  17. endpoints served by Alertmanager. If omitted, relevant URL components
  18. will be derived automatically.
  19. --web.route-prefix=WEB.ROUTE-PREFIX
  20. Prefix for the internal routes of web endpoints. Defaults to path of
  21. --web.external-url.
  22. --web.listen-address=":9093"
  23. Address to listen on for the web interface and API.
  24. --web.get-concurrency=0 Maximum number of GET requests processed concurrently. If negative or
  25. zero, the limit is GOMAXPROC or 8, whichever is larger.
  26. --web.timeout=0 Timeout for HTTP requests. If negative or zero, no timeout is set.
  27. --cluster.listen-address="0.0.0.0:9094"
  28. Listen address for cluster. Set to empty string to disable HA mode.
  29. --cluster.advertise-address=CLUSTER.ADVERTISE-ADDRESS
  30. Explicit address to advertise in cluster.
  31. --cluster.peer=CLUSTER.PEER ...
  32. Initial peers (may be repeated).
  33. --cluster.peer-timeout=15s
  34. Time to wait between peers to send notifications.
  35. --cluster.gossip-interval=200ms
  36. Interval between sending gossip messages. By lowering this value
  37. (more frequent) gossip messages are propagated across the cluster
  38. more quickly at the expense of increased bandwidth.
  39. --cluster.pushpull-interval=1m0s
  40. Interval for gossip state syncs. Setting this interval lower (more
  41. frequent) will increase convergence speeds across larger clusters at
  42. the expense of increased bandwidth usage.
  43. --cluster.tcp-timeout=10s Timeout for establishing a stream connection with a remote node for a
  44. full state sync, and for stream read and write operations.
  45. --cluster.probe-timeout=500ms
  46. Timeout to wait for an ack from a probed node before assuming it is
  47. unhealthy. This should be set to 99-percentile of RTT (round-trip
  48. time) on your network.
  49. --cluster.probe-interval=1s
  50. Interval between random node probes. Setting this lower (more
  51. frequent) will cause the cluster to detect failed nodes more quickly
  52. at the expense of increased bandwidth usage.
  53. --cluster.settle-timeout=1m0s
  54. Maximum time to wait for cluster connections to settle before
  55. evaluating notifications.
  56. --cluster.reconnect-interval=10s
  57. Interval between attempting to reconnect to lost peers.
  58. --cluster.reconnect-timeout=6h0m0s
  59. Length of time to attempt to reconnect to a lost peer.
  60. --log.level=info Only log messages with the given severity or above. One of: [debug,
  61. info, warn, error]
  62. --log.format=logfmt Output format of log messages. One of: [logfmt, json]
  63. --version Show application version.

nginx子路径代理不需要额外的其他配置

注意:promethes配置nginx访问子路径设置的是:--web.external-url,但是alertmanager不需要该配置

比如:

  1. # cat /usr/lib/systemd/system/alertmanager.service
  2. [Unit]
  3. Description=alertmanager
  4. After=network.target
  5. [Service]
  6. Type=simple
  7. User=prometheus
  8. ExecStart=/usr/local/alertmanager/alertmanager --config.file=/usr/local/alertmanager/alertmanager.yml --storage.path=/usr/local/alertmanager/data
  9. Restart=on-failure
  10. [Install]
  11. WantedBy=multi-user.target

nginx反向代理设置

  1. location /alertmanager/ {
  2. proxy_pass http://192.168.0.185:9093/;
  3. proxy_set_header Host $host:$server_port;
  4. proxy_set_header X-Real-IP $remote_addr;
  5. proxy_set_header X-Real-PORT $remote_port;
  6. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  7. }

安装Alertmanager,nginx配置二级路径代理访问的更多相关文章

  1. Nginx 配置二级虚拟目录访问 Laravel 重写

    server { listen 80; server_name _; root /opt/sites; index index.php index.html index.htm; etag on; g ...

  2. Nginx配置实例-反向代理实例:根据访问的路径跳转到不同端口的服务中

    场景 Ubuntu Server 16.04 LTS上怎样安装下载安装Nginx并启动: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/detai ...

  3. eclipse加速/Nginx配置跨域代理

    下班时间到啦! --下班都是他们的,而我,还是什么都没有. eclipse加速 去掉包含js文件的包的js验证,否则每次启动都需要进行校验(右击项目->properties) Nginx配置跨域 ...

  4. Windows下Nginx配置SSL实现Https访问(包含证书生成)

    Vincent.李   Windows下Nginx配置SSL实现Https访问(包含证书生成) Windows下Nginx配置SSL实现Https访问(包含证书生成) 首先要说明为什么要实现https ...

  5. 使用nginx配置二级域名

    使用nginx配置二级域名 2018.11.21 11:51:17字数 613阅读 170 最近想把三个项目配在一个服务器上,于是想使用nginx配置二级域名实现. 1.域名添加解析 我的是阿里云的域 ...

  6. docker 安装redis 并配置外网可以访问

    1, docker 拉去最新版本的redis docker pull redis #后面可以带上tag号, 默认拉取最新版本 2, docker安装redis container 安装之前去定义我们的 ...

  7. docker 安装redis 并配置外网可以访问 - flymoringbird的博客 - CSDN博客

    原文:docker 安装redis 并配置外网可以访问 - flymoringbird的博客 - CSDN博客 端口映射,data目录映射,配置文件映射(在当前目录下进行启动). docker run ...

  8. Nginx配置二级目录/路径 映射不同的反向代理和规避IP+端口访问

       当配置Nginx来映射不同的服务器 可以通过二级路径来反向代理 来解决一个外网端口实现多个服务访问. 配置如下: server { listen ; server_name demo.domai ...

  9. nginx配置二级目录,反向代理不同ip+端口

    场景描述: 通过二级目录(虚拟目录,应用程序)的方式访问同一ip+端口的不同应用,例如location是用户使用页面,location/admin/是管理页面,location部署在192.168.1 ...

随机推荐

  1. CSS进阶内容—浮动和定位详解

    CSS进阶内容-浮动和定位详解 我们在学习了CSS的基本知识和盒子之后,就该了解一下网页的整体构成了 当然如果没有学习之前的知识,可以到我的主页中查看之前的文章:秋落雨微凉 - 博客园 CSS的三种布 ...

  2. 【Azure 存储服务】Hadoop集群中使用ADLS(Azure Data Lake Storage)过程中遇见执行PUT操作报错

    问题描述 在Hadoop集中中,使用ADLS 作为数据源,在执行PUT操作(上传文件到ADLS中),遇见 400错误[put: Operation failed: "An HTTP head ...

  3. 005_面试题 Java_传递方式

    面试题: 问:java是值传递还是引用传递? 答:java只有值传递,基本类型传递的是具体的数,引用类型传递的是具体的地址

  4. 如何验收安卓PCBA主板的质量和性能

    . 版本:v0.1 作者:河东西望 日期:2022-7-15 . 目录 1 有哪些情况需要验收? 2 有哪些验收测试? 2.1 主板测试 2.2 工程测试 2.3 性能测试 2.4 压力测试 2.5 ...

  5. Solution -「2020.12.26」 模拟赛

    0x00 前言 一些吐槽. 考得很变态诶,看每道题平均两秒的时限就知道了... T1 降智了想到后缀懒得打. T2 口胡了假优化,结果和暴力分一样?? T3 黑题还绑点?? \(50 + 80 + 0 ...

  6. shell查询prometheus数据

    #shell查询prometheus数据 shell使用curl调用HTTP API执行PromQL /api/v1/query查询某一时刻的数据 查询条件PromSQL复杂时, 传入接口/api/v ...

  7. 串口通信:接受数据(仿真task写法)

    1.功能描述 设计一个串口数据接收模块.能够以设定的波特率(与发射端口速率匹配)接收数据,并输出保存到一个寄存器中. 2.过程描述 ①边沿检测器,识别出起始位时让接收使能端有效.这里需要排除边沿脉冲的 ...

  8. 二重循环中的break与continue

    二重循环中的break和continue用于控制本层循环,注意其不会影响外层循环的执行,这边和C中的break和continue的作用范围是一样的,也符合逻辑 example: 点击查看代码 for ...

  9. 浅谈Meet in the middle——MITM

    目测观看人数 \(0+0+0=0\) \(\mathrm{Meet\;in\;the\;middle}\)(简称 \(\rm MITM\)),顾名思义就是在中间相遇. 可以理解为就是起点跑搜索树基本一 ...

  10. 封装Fraction-分数类(C++)

    Fraction 分数类 默认假分数,可自行修改 由于concept的原因 template <typename T> concept is_float_v = std::is_float ...