津爱改装车|我选择的开源运维监控系统-Prometheus
简介运维监控系统 , 不用多介绍 , 网上有很多介绍的文章 。
为什么选择Prometheus呢?大家应该都有自己的理由 。
- 部署简单 , Go写的程序基本上解压就可以使用 , 不用太多的依赖安装 。
- 服务自动化发现 , 可以使用console , 也可以使用动态文件的方式(这个是我想用的) 。
- 高性能 , 单点就有很高的性能 , 目前很多监控系统都支持分布式 , 单点性能不好 , 靠分布式来缓解压力 。
- 强大的查询语句 , 有很多实用的函数 , 可以提供给我们查询分析 。
- 结合grafana可以快速地实现图表 。
部署测试在Prometheus的官网 , 可以快速下载到安装包 , 就是一个 压缩包而已 。 有支持了很多平台 , 我们还是习惯在Linux上进行部署 。
tar zxvf prometheus-2.20.0.linux-amd64.tar.gz
# my global configglobal:scrape_interval:15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.# scrape_timeout is set to the global default (10s).# Alertmanager configurationalerting:alertmanagers:- static_configs:- targets:# - alertmanager:9093?# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.rule_files:# - "first_rules.yml"# - "second_rules.yml"?# A scrape configuration containing exactly one endpoint to scrape:# Here it's Prometheus itself.scrape_configs:# The job name is added as a label `job=` to any timeseries scraped from this config.- job_name: 'prometheus'?# metrics_path defaults to '/metrics'# scheme defaults to 'http'.?static_configs:- targets: ['localhost:9090']
- global:prometheus的全局配置 ,比如采集间隔 , 抓取超时时间等 。
- alerting:配置altermanager , prometheus将报警规则推送到指定的alertmanager实例地址
- rule_files:报警规则文件 ,prometheus根据规则信息 , 会推送报警信息到alertmanager中 。
- scrape_configs:抓取配置 , prometheus通过这里的配置采集数据 。
scrape_configs:# The job name is added as a label `job=` to any timeseries scraped from this config.- job_name: 'prometheus'?# metrics_path defaults to '/metrics'# scheme defaults to 'http'.?static_configs:- targets: ['localhost:9090']
vim /usr/lib/systemd/system/prometheus.service
[Unit]Description=prometheusAfter=network.target?[Service]Type=simpleWorkingDirectory=/opt/prometheus/prometheusExecStart=/opt/prometheus/prometheus --config.file="/opt/prometheus/prometheus.yml"LimitNOFILE=65536PrivateTmp=trueRestartSec=2StartLimitInterval=0Restart=always?[Install]WantedBy=multi-user.target
推荐阅读
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 地史食堂|未必需要开凿克拉运河,泰国还有第二选择,和新加坡竞争
- 王者MrPoker|到底有多难打?,不会根据局势来选择出装
- 特朗普|最新美国大选民调结果!52%的人选择拜登,领先特朗普10个点
- 行车视线|颜值惊艳 提供两种动力选择,起亚全新K5凯酷将于今日上市
- Java|计算机专业的本科生,该选择学习Java技术体系还是.NET技术体系
- 百二关河|为何选择策反钟会,他真的有复国的可能吗,姜维在蜀汉灭亡后
- 老靳行色|也要从撤离中国,而中不但不生气反而选择谅解,宁愿自损160亿
- 游戏攻略|《我的勇士》世界boss辅助选什么?世界boss辅助选择推荐
- 加拿大必读|领先特朗普10个点,最新美国大选民调结果!52%的人选择拜登
- ZAKER|高净值人群想要规避风险?海外房产或是一个不可多得的选择!