linux安装普罗米修斯Prometheus监控

编程入门 行业动态 更新时间:2024-10-28 02:21:54

linux安装<a href=https://www.elefans.com/category/jswz/34/1716233.html style=普罗米修斯Prometheus监控"/>

linux安装普罗米修斯Prometheus监控

安装目录: 

10.10.10.10prometheus、Grafana9090、3000
10.10.10.11node_exporter9010
10.10.10.12node_exporter9010
10.10.10.13node_exporter9010

1.prometheus官网

wget .42.0/prometheus-2.42.0.linux-amd64.tar.gz

2.Grafana官网

wget .1.1.linux-amd64.tar.gz
wget .1.1-1.x86_64.rpm

3.node_exporter下载

wget .5.0/node_exporter-1.5.0.linux-amd64.tar.gz

一.prometheus安装 

[root@localhost ~]# tar -zxvf  prometheus-2.42.0.linux-amd64.tar.gz  -C  /usr/local/
[root@localhost ~]# cd /usr/local/
[root@localhost local]# mv prometheus-2.42.0.linux-amd64 prometheus
[root@localhost local]# cd prometheus/
[root@localhost prometheus]# ./prometheus --config.file=prometheus.yml &
[root@localhost prometheus]# ps -ef |grep prometheus
root      34154  33916  2 17:30 pts/0    00:00:00 ./prometheus --config.file=prometheus.yml
root      34164  33916  0 17:30 pts/0    00:00:00 grep --color=auto prometheus

 访问::9090  (prometheus默认端口是9090)

查看监控机器:Status —Targets,目前只监控了本机

添加监控机器 

找到prometheus的安装目录下的配置文件prometheus.yml,在配置文件中添加agent机器ip+端口

# my global config
global: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 configuration
alerting: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=<job_name>` to any timeseries scraped from this config.- job_name: "prometheus"# metrics_path defaults to '/metrics'# scheme defaults to 'http'.static_configs:- targets: ["localhost:9090"]#添加被监控机器- job_name: 'agent'static_configs:- targets: ['10.10.10.11:9100']

重启prometheus

 访问::9090 查看是否有被监控的agent机器

 二.安装node_exporter

[root@localhost ~]# ls
anaconda-ks.cfg  node_exporter-1.5.0.linux-amd64.tar.gz
[root@localhost ~]# tar -zxvf node_exporter-1.5.0.linux-amd64.tar.gz  -C /usr/local/
node_exporter-1.5.0.linux-amd64/
node_exporter-1.5.0.linux-amd64/LICENSE
node_exporter-1.5.0.linux-amd64/NOTICE
node_exporter-1.5.0.linux-amd64/node_exporter
[root@localhost ~]# cd /usr/local/
[root@localhost local]# ls
bin  conf  etc  games  include  jdk1.8.0_333  lib  lib64  libexec  mysql  nginx  node_exporter-1.5.0.linux-amd64  sbin  share  src  zabbix_agent
[root@localhost local]# mv node_exporter-1.5.0.linux-amd64/ node_exporter
[root@localhost local]# cd node_exporter/
[root@localhost node_exporter]# ls
LICENSE  node_exporter  NOTICE
[root@localhost node_exporter]# ./node_exporter &
[root@localhost node_exporter]# ps -ef |grep node_exporter 
root      11202  10682  0 17:54 pts/1    00:00:00 ./node_exporter
root      11213  10682  0 17:54 pts/1    00:00:00 grep --color=auto node_exporter

 node_exporter的默认端口是9100,上面已经提前配置10.10.10.10这个台机的监控

三.Grafana安装

[root@localhost ~]# rpm -ivh grafana-enterprise-10.1.1-1.x86_64.rpm 
警告:grafana-enterprise-10.1.1-1.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 24098cb6: NOKEY
错误:依赖检测失败:urw-fonts 被 grafana-enterprise-10.1.1-1.x86_64.rpm 需要
[root@localhost ~]# yum install -y urw-fonts 或者忽视依赖安装:
[root@localhost ~]# rpm -ivh grafana-enterprise-10.1.1-1.x86_64.rpm --nodeps --force
警告:grafana-enterprise-10.1.1-1.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 24098cb6: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...1:grafana-enterprise-10.1.1-1       ################################# [100%]
### NOT starting on installation, please execute the following statements to configure grafana to start automatically using systemdsudo /bin/systemctl daemon-reloadsudo /bin/systemctl enable grafana-server.service
### You can start grafana-server by executingsudo /bin/systemctl start grafana-server.service
POSTTRANS: Running script启动:
[root@localhost ~]# systemctl start grafana-server
[root@localhost ~]# ps -ef |grep grafana
grafana   34191      1  5 18:00 ?        00:00:00 /usr/sbin/grafana-server --config=/etc/grafana/grafana.ini --pidfile=/var/run/grafana/grafana-server.pid --packaging=rpm cfg:default.paths.logs=/var/log/grafana cfg:default.paths.data=/var/lib/grafana cfg:default.paths.plugins=/var/lib/grafana/plugins cfg:default.paths.provisioning=/etc/grafana/provisioning
root      34201  33916  0 18:01 pts/0    00:00:00 grep --color=auto grafana

访问::3000(默认端口是3000)初始用户名和密码都是admin

如果Grafana密码忘记了,可以使用命令重置:

grafana-cli admin reset-admin-password admin233%#

设置简体中文:

 

在Grafana中配置prometheus

1.添加数据源

查看添加的数据源 :

导入官方模板:Dashboards | Grafana Labs 

 

导入别人的模板:

别人的模板导出

别人的模板导入

导入别人的模板后报错:

Failed to upgrade legacy queries Datasource D3UDCoh4z was not found

解决:参考

{...........................#修改前"datasource": {"type": "prometheus","uid": "xxxx-uid"},#所有的都修改成这样"datasource": {"type": "prometheus","uid": "prometheus"},...........................
}

更多推荐

linux安装普罗米修斯Prometheus监控

本文发布于:2024-03-09 00:07:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1722957.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:普罗米修斯   linux   Prometheus

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!