监控组件Prometheus安装配置

3 篇文章 0 订阅
2 篇文章 0 订阅

监控组件普罗米修斯Prometheus

Prometheus是Google BorgMon监控系统的开源版本。伴随着容器及Kubernetes技术的兴起,Prometheus越来越受到大家的关注。

Prometheus下载地址:

https://prometheus.io/download/

Prometheus服务端安装

下载服务端

wget -c https://github.com/prometheus/prometheus/releases/download/v2.15.2/prometheus-2.15.2.linux-amd64.tar.gz
tar -zxvf prometheus-2.15.2.linux-amd64.tar.gz -C /usr/local/

主要文件

  • prometheus.yml --主配置文件
  • prometheus --启动脚本

启动服务端

./prometheus --config.file=prometheus.yml --storage.tsdb.path=data/

添加用户

groupadd -r prometheus
useradd  -r -g prometheus -s /sbin/nologin prometheus

编辑服务单元配置

[Unit]
Description=Prometheus monitor Server
Documentation=/usr/local/prometheus-2.15.2.linux-amd64/prometheus --help
Documentation=https://prometheus.io/docs/introduction/overview/
After=network.target 

[Install]
WantedBy=multi-user.target

[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/prometheus-2.15.2.linux-amd64/prometheus --config.file=/usr/local/prometheus-2.15.2.linux-amd64/prometheus.yml --storage.tsdb.path=/usr/local/prometheus-2.15.2.linux-amd64/data/
Restart=on-failure

通过服务单元进行启动

systemctl daemon-reload
systemctl start prometheus

访问服务端UI界面

http://ipAddr:9090

Prometheus支持多语言客户端,可对核心业务进行埋点
一些主流应用可以通过官方或第三方的导出器,来对这些应用做核心指标的收集例如Redis和MySQL等等
prometheus同样也支持系统和网络相关的exporter方便服务器资源的监控

下载并启动node_exporter监控服务器资源

wget -c https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz
tar -zxvf node_exporter-0.18.1.linux-amd64.tar.gz -C /usr/local
./node_exporter

服务器编辑prometheus.yml添加node地址

- job_name: 'node_localhost'
 static_configs:
 - targets: ['localhost:9100']

重新启动服务端

systemctl restart prometheus

安装grafana

grafana下载地址

https://grafana.com/grafana/download

dashboard下载地址

https://grafana.com/grafana/dashboards

插件下载地址

https://grafana.net/plugins/

wget -c https://dl.grafana.com/oss/release/grafana-6.1.4-1.x86_64.rpm
yum localinstall grafana-6.1.4-1.x86_64.rpm
systemctl start grafana-server

导入方式

      Grafana首页–>左上角图标–>Dashboard–>import

      加入1-node-exporter-0-16-0-17-for-prometheus_rev7.json这个插件

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Prometheus是一款开源的监控系统,它可以收集和处理各种类型的指标数据,并提供数据查询、报警等功能,成为了云原生领域中非常重要的监控工具之一。下面是关于Prometheus安装配置的一些建议。 首先,我们需要在官网下载Prometheus,并解压缩到指定目录中。在解压后的目录中,可以看到例如bin、config等文件夹以及prometheus.yml配置文件等。prometheus.yml是Prometheus的主配置文件,其中定义了需要收集哪些指标数据。 在prometheus.yml文件中,需要指定需要采集数据的服务器及数据采集的方式,可以使用多种方式,例如通过pushgateway推送或者使用Exporter等。另外,还需要配置警报规则和图表展示,可以使用Prometheus自带的Alertmanager和Grafana等工具。 在安装配置的过程中,需要注意以下事项: 1、通过在命令行中运行prometheus --config.file=prometheus.yml指定prometheus.yml所在的路径,启动Prometheus服务。 2、需要定期备份Prometheus的数据内容,特别是警报规则、报警历史记录等。 3、需要配置正确的时区和日期时间格式,以确保监控数据的正确性。 4、需要定期更新Prometheus及其组件,以获得最新的安全补丁和新功能。 总之,Prometheus安装配置需要慎重考虑,需要根据自身场景进行定制化操作,以确保其稳定性和可靠性。同时,需要通过持续的监控和报警来及时发现和解决问题,以在企业中更好地应用Prometheus监控系统。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值