安装配置 Alertmanager

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

创建启动文件

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

vim /usr/lib/systemd/system/alertmanager.service 

[Unit]
Description=alertmanager
Documentation=https://github.com/prometheus/alertmanager
After=network.target [Service]
Type=simple
User=prometheus
ExecStart=/usr/local/alertmanager/alertmanager --config.file=/usr/local/alertmanager/alertmanager.yml --storage.path=/usr/local/alertmanager/data
Restart=on-failure [Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl start alertmanager.service
systemctl status alertmanager.service
systemctl enable alertmanager.service

启动命令参考参数

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

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

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

比如:

# cat /usr/lib/systemd/system/alertmanager.service
[Unit]
Description=alertmanager
After=network.target [Service]
Type=simple
User=prometheus
ExecStart=/usr/local/alertmanager/alertmanager --config.file=/usr/local/alertmanager/alertmanager.yml --storage.path=/usr/local/alertmanager/data
Restart=on-failure [Install]
WantedBy=multi-user.target

nginx反向代理设置

    location /alertmanager/ {
proxy_pass http://192.168.0.185:9093/;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-PORT $remote_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

安装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. 《深入理解java虚拟机》读书笔记-第二章Java内存区域和内存溢出异常

    java1.7和java8的jvm存在差异,本文先按照<深入理解java虚拟机>的讲解内容总结,并将java8的改变作为附录放在文末 一丶运行时数据区域 ​ 图:java虚拟机运行时数据区 ...

  2. 2022-7-10 css 第七组 刘昀航

    ​ 样式通常存储在样式表中(先定义样式表),再把样式表添加到html元素中 定义CSS样式的方式: 行内样式(内联样式) ​ ·行内样式仅针对当前标签生效,如果当前的样式不需要复用,可以用行内样式 · ...

  3. Flink Window&Time 原理

    Flink 中可以使用一套 API 完成对有界数据集以及无界数据的统一处理,而无界数据集的处理一般会伴随着对某些固定时间间隔的数据聚合处理.比如:每五分钟统计一次系统活跃用户.每十秒更新热搜榜单等等 ...

  4. VMware Workstation是可以跟hyper-v 共存的!

    VMware Workstation是可以跟hyper-v 共存的! 神奇的事情 之前一直不知道这个事情,后来发现,原来是可以的,震惊了我的双眼. 我之前一直用的是桌面的Docker Desktop ...

  5. 字符串的操作和MAth工具类

    字符串的操作 常用方法 判断功能方法 equals(String s)判断两个字符串是否相同,区分大小写 equsalsignorecase(String s) 判断两个字符串是否相同,不区分大小写 ...

  6. python 装饰器理解

    简介 装饰器可以在不修改原有代码的基础上添加新的功能,可以将重复重用的代码抽取出来,进一步解耦,方便维护,一般适用于插入日志.性能测试.事务处理.缓存等 装饰器的前提 闭包 一般来说,当一个函数嵌套另 ...

  7. 1个小时!从零制作一个! AI图片识别WEB应用!

    0 前言 近些年来,所谓的人工智能也就是AI. 在媒体的炒作下,变得神乎其神,但实际上,类似于图片识别的AI,其原理只不过是数学的应用. 线性代数,概率论,微积分(著名的反向传播算法). 大家觉得这些 ...

  8. Mac os:将Homebrew的下载源换成国内镜像增加下载速度(阿里云镜像)

    原文转载自「刘悦的技术博客」https://v3u.cn/a_id_135 可能所有的mac os系统爱好者都遇到过下面这种倒霉情况,在网络环境不太好的时候,你满怀期待的敲下 brew install ...

  9. Mqtt开发笔记:windows下C++ ActiveMQ客户端介绍、编译和使用

    前话   项目需求,需要使用到mqtt协议,之前编译QtMqtt库,不支持队列模式queue(点对点),只支持订阅/发布者模式.,所以使用C++ ActiveMQ实现.   MQTT协议 简介   M ...

  10. Scala中使用 Jackson API 进行JSON序列化和反序列化

    1.  什么是 Json 序列化 和 反序列化 序列化 => 将 Java对象 转换成 json字符串反序列化 => 将 json字符串 转换成 Java对象 2. 依赖包 说明 < ...