【云原生 | Kubernetes 系列】---Prometheus 联邦

news/2024/5/19 0:03:44 标签: kubernetes, 云原生, prometheus

云原生 | Kubernetes 系列】—Prometheus 联邦

序号服务器IP角色
1192.168.31.201prometheus-server
2192.168.31.121prometheus-node1
3192.168.31.122prometheus-node2
4192.168.31.123prometheus-node3
5192.168.31.101k8s-node-exporter1
6192.168.31.102k8s-node-exporter2
7192.168.31.103k8s-node-exporter3
8192.168.31.111k8s-node-exporter4
9192.168.31.112k8s-node-exporter5
10192.168.31.113k8s-node-exporter6
11192.168.31.114k8s-node-exporter7

请添加图片描述

1. Prometheus搭建

  1. 将安装包和service文件复制到3台联邦节点上
# scp prometheus-2.38.0.linux-amd64.tar.gz 192.168.31.121:/apps/
# scp /etc/systemd/system/prometheus.service 192.168.31.121:/etc/systemd/system/prometheus.service

# scp prometheus-2.38.0.linux-amd64.tar.gz 192.168.31.122:/apps/
# scp /etc/systemd/system/prometheus.service 192.168.31.122:/etc/systemd/system/prometheus.service

# scp prometheus-2.38.0.linux-amd64.tar.gz 192.168.31.123:/apps/
# scp /etc/systemd/system/prometheus.service 192.168.31.123:/etc/systemd/system/prometheus.service
  1. 在3台联邦服务器上安装prometheus
root@zookeeper-3:/apps# cd /apps
root@zookeeper-3:/apps# tar xf prometheus-2.38.0.linux-amd64.tar.gz
root@zookeeper-3:/apps# ln -sf /apps/prometheus-2.38.0.linux-amd64 /apps/prometheus

2. 所有节点安装node-exporter

这些节点之前都装过了,就不再复述了
只要确认可以通过nose:9100/metrics访问到数据即可

请添加图片描述

3. 配置联邦

prometheusnode1_54">3.1 prometheus-node1

/apps/prometheus/prometheus.yml追加node-exporter配置

  - job_name: "node-exporter"
    static_configs:
      - targets: ["192.168.31.101:9100","192.168.31.102:9100","192.168.31.103:9100"]

启动服务后确认9090监听是否正常

root@zookeeper-1:/apps/prometheus# systemctl enable --now prometheus.service 
Created symlink /etc/systemd/system/multi-user.target.wants/prometheus.service → /etc/systemd/system/prometheus.service.
root@zookeeper-1:/apps/prometheus# ss -ntl|grep 9090
LISTEN  0       4096                    *:9090                 *:*      

在web页面上查看是否正常获取到数据

请添加图片描述

prometheusnode_75">3.2 其他prometheus-node节点

prometheus-node2

  - job_name: "node-exporter"
    static_configs:
      - targets: ["192.168.31.111:9100","192.168.31.112:9100"]

prometheus-node3

  - job_name: "node-exporter"
    static_configs:
      - targets: ["192.168.31.113:9100","192.168.31.114:9100"]

请添加图片描述

请添加图片描述

prometheusserver_99">4. 配置prometheus-server

修改配置prometheus.yml将以下配置加入scrape_configs:

scrape_configs:
  - job_name: "prometheus-federate"
    scrape_interval: 10s
    honor_labels: true
    metrics_path: '/federate'
    params:
      'match[]':
      - '{job="prometheus"}'
      - '{__name__=~"job:.*"}'
      - '{__name__=~"node.*"}'
    static_configs:
    - targets:
      - '192.168.31.121:9090'
      - '192.168.31.122:9090'
      - '192.168.31.123:9090'

重启prometheus服务后
在Targets下看到了联邦的3个node节点.

请添加图片描述

此时其他配置都已经删除了,所以只有这么一个配置.
查询node_load1时可以看到3个node分别收集的node信息在server上都能正常获取到

请添加图片描述

5. Grafana导入

8919

请添加图片描述


http://www.niftyadmin.cn/n/1021439.html

相关文章

在CentOS上安装Hadoop 2.x 集群

环境:CentOS 6.5, OPenJDK 1.7, Hadoop 2.2.0 本文主要参考官网的文档,Hadoop 2.2.0 Single Node Setup,Hadoop 2.2.0 Cluster Setup (可选)创建新用户 一般我倾向于把需要启动daemon进程,对外提供服务的…

【云原生 | Kubernetes 系列】---Prometheus 数据高可用

Prometheus 数据高可用 默认情况下,prometheus将采集到的数据存储在本地的TSDB数据库中国,路径默认为prometheus安装目录的data目录.数据写入过程为先把数据写入wal日志并存放在内存,然后2小时候将内存数据保存至一个新的block块,同时再把新采集的数据写入内存并在2小时候再保…

一步一步在Linux上升级10gR2 RAC到11gR2 RAC(1)

概述: 继本人上一个系列的Oracle 11gR2 RACDG项目实战教程发布已一年有余,在此期间,那个系列的教程得到众多网友的喜爱与好评,更是在互联网上畅销不衰。为此,众多网友也一直希望本人推出Oracle 10gR2 RAC的系列教程&am…

新鲜的团队名单出炉啦!

【TA Team】团队名单【队员介绍】email: ycdxsbmail.ustc.edu.cnduty: 组长,统筹全局233,服务器端,网页设计Introduction: 组员大佬太多,外部竞争激烈,压力满满。希望在团对作业中可以锻炼自己的交际能力&#x…

一步一步在Linux上升级10gR2 RAC到11gR2 RAC(2)

6 停止10gR2 RAC软件 A 停止数据库 [rootnode1 ~]# su - oracle node1-> crs_stat -t Name Type Target State Host ------------------------------------------------------------ ora.devdb.db application ONLINE ONL…

下拉菜单中的jquery 和 animate动画效果

1.布局的过程中一定要记住给下拉区域定位 2.下拉的选框slideToggle();下拉 3.动画简单操作transition 秒数转载于:https://www.cnblogs.com/xinkun/p/7827012.html

【云原生 | Kubernetes 系列】---Ceph报错ExecutableNotFound: Could not locate executable ‘ceph-disk‘ make sure

故障现象: 在添加osd节点时出现了以下报错: cephadminceph-mgr01:~/ceph-cluster$ ceph-deploy disk list ceph-node01 [ceph_deploy.conf][DEBUG ] found configuration file at: /home/cephadmin/.cephdeploy.conf [ceph_deploy.cli][INFO ] Invoked (1.5.38): /usr/bin/c…

一步一步在Linux上升级10gR2 RAC到11gR2 RAC(3)

8 安装grid软件 解压grid安装介质: [rootnode1 ~]# unzip p13390677_112040_Linux-x86-64_3of7.zip 解压出第3个压缩包,解压之后,将grid文件mv到/home/oracle家目录下: [rootnode1 ~]# ll total 3667892 drwxr-xr-x 4 root…