本文主要记录下测试环境积累的prometheus配置信息,主要是k8s基本节点的配置和cadvisor的配置,方便以后使用做为参考

global:
scrape_interval: 30s
scrape_timeout: 30s
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'kubernetes-cluster'
scheme: https
tls_config:
insecure_skip_verify: true
kubernetes_sd_configs:
- api_server: "http://192.168.180.101:8080"
role: node
- job_name: 'kubernetes-service-endpoints'
scheme: https
tls_config:
insecure_skip_verify: true
kubernetes_sd_configs:
- api_server: "http://192.168.180.101:8080"
role: endpoints
relabel_configs:
- source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scrape]
action: keep
regex: true
- source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scheme]
action: replace
target_label: __scheme__
regex: (https?)
- source_labels: [__meta_kubernetes_service_annotation_prometheus_io_path]
action: replace
target_label: __metrics_path__
regex: (.+)
- source_labels: [__address__, __meta_kubernetes_service_annotation_prometheus_io_port]
action: replace
target_label: __address__
regex: (.+)(?::\d+);(\d+)
replacement: $1:$2
- action: labelmap
regex: __meta_kubernetes_service_label_(.+)
- source_labels: [__meta_kubernetes_service_namespace]
action: replace
target_label: kubernetes_namespace
- source_labels: [__meta_kubernetes_service_name]
action: replace
target_label: kubernetes_name
- job_name: 'kubernetes-services'
scheme: https
tls_config:
insecure_skip_verify: true
metrics_path: /probe
params:
module: [http_2xx]
kubernetes_sd_configs:
- api_server: "http://192.168.180.101:8080"
role: service
relabel_configs:
- source_labels: [__meta_kubernetes_service_annotation_prometheus_io_probe]
action: keep
regex: true
- source_labels: [__address__]
target_label: __param_target
- target_label: __address__
replacement: blackbox
- source_labels: [__param_target]
target_label: instance
- action: labelmap
regex: __meta_kubernetes_service_label_(.+)
- source_labels: [__meta_kubernetes_service_namespace]
target_label: kubernetes_namespace
- source_labels: [__meta_kubernetes_service_name]
target_label: kubernetes_name
- job_name: 'kubernetes-pods'
scheme: https
tls_config:
insecure_skip_verify: true
kubernetes_sd_configs:
- api_server: "http://192.168.180.101:8080"
role: pod
relabel_configs:
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
action: keep
regex: true
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path]
action: replace
target_label: __metrics_path__
regex: (.+)
- source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]
action: replace
regex: (.+):(?:\d+);(\d+)
replacement: ${1}:${2}
target_label: __address__
- action: labelmap
regex: __meta_kubernetes_pod_label_(.+)
- source_labels: [__meta_kubernetes_pod_namespace]
action: replace
target_label: kubernetes_namespace
- source_labels: [__meta_kubernetes_pod_name]
action: replace
target_label: kubernetes_pod_name
# Scrape config for Kubelet cAdvisor.
#
# This is required for Kubernetes 1.7.3 and later, where cAdvisor metrics
# (those whose names begin with 'container_') have been removed from the
# Kubelet metrics endpoint. This job scrapes the cAdvisor endpoint to
# retrieve those metrics.
#
# In Kubernetes 1.7.0-1.7.2, these metrics are only exposed on the cAdvisor
# HTTP endpoint; use "replacement: /api/v1/nodes/${1}:4194/proxy/metrics"
# in that case (and ensure cAdvisor's HTTP server hasn't been disabled with
# the --cadvisor-port=0 Kubelet flag).
#
# This job is not necessary and should be removed in Kubernetes 1.6 and
# earlier versions, or it will cause the metrics to be scraped twice.
# 在k8s 1.6和以前的版本不用增加cadvisor数据采集,之后的版本就需要单独增加cadvisor采集数据
- job_name: 'kubernetes-nodes-cadvisor'
# Default to scraping over https. If required, just disable this or change to
# `http`.
scheme: http
tls_config:
insecure_skip_verify: true
kubernetes_sd_configs:
- api_server: "http://192.168.180.101:8080"
# 这里的role一定要注意是node
role: node
relabel_configs:
- source_labels: [__meta_kubernetes_role]
action: replace
target_label: kubernetes_role
regex: (.+)
# 将默认10250端口改成10255端口
- source_labels: [__address__]
action: replace
regex: '(.*):10250'
replacement: '${1}:10520'
target_label: __address__
- action: labelmap
regex: __meta_kubernetes_node_label_(.+)

prometheus配置的更多相关文章

  1. prometheus 配置介绍

    prometheus 配置介绍 prometheus 配置分global.alerting.rule_files.scrape_configs 1.global(全局配置) scrape_interv ...

  2. Prometheus 配置采集目标

    Prometheus 配置采集目标 1.根据配置的任务(job)以http/s周期性的收刮(scrape/pull)2.指定目标(target)上的指标(metric).目标(target)3.可以以 ...

  3. 实用干货丨如何使用Prometheus配置自定义告警规则

    前 言 Prometheus是一个用于监控和告警的开源系统.一开始由Soundcloud开发,后来在2016年,它迁移到CNCF并且称为Kubernetes之后最流行的项目之一.从整个Linux服务器 ...

  4. prometheus 配置容器 cadvisor监控节点

    安装cadvisor docker run \ --volume=/:/roofs:ro \ --volume=/var/run:/var/run:rw \ --volume=/sys:/sys:ro ...

  5. prometheus配置简介

    参考网页:https://my.oschina.net/wangyunlong/blog/3060776 global: scrape_interval:             15s evalua ...

  6. prometheus配置pushgateway功能测试

    一.环境: 1.prometheus服务器ip:192.168.0.208 2.node-exporter客户机ip:192.168.0.202 二.测试设计考虑: pushgateway类似一台信息 ...

  7. prometheus配置详情

    https://prometheus.io/docs/prometheus/latest/configuration/configuration/ 下面监控宿主机和容器的内存,CPU,磁盘等状态 gr ...

  8. 重载Prometheus配置

    发送SIGHUP信号给应用程序的主进程: pid ‘’-1‘’是指“终端断线” 发送post请求给指定端点: curl -XPOST http://ip:9090/-/reload 对于此种方法要注意 ...

  9. 使用prometheus抓取k8s的metrics作监控时,cAdvisor和kubelet配置有何差别?

    按网上说法: 目前cAdvisor集成到了kubelet组件内,可以在kubernetes集群中每个启动了kubelet的节点使用cAdvisor提供的metrics接口获取该节点所有容器相关的性能指 ...

随机推荐

  1. python selenium --unittest 框架

    转自:http://www.cnblogs.com/fnng/p/3300788.html 学习unittest 很好的一个切入点就是从selenium IDE 录制导出脚本.相信不少新手学习sele ...

  2. 任务调度Cron表达式及Quartz代码详解

    在线Cron表达式生成器 http://cron.qqe2.com/ cron表达式详解 http://www.cnblogs.com/linjiqin/archive/2013/07/08/3178 ...

  3. PHP扩展开发及内核应用(未完)

    转: https://github.com/walu/phpbook

  4. unity文件写入与读取

    using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEditor; us ...

  5. 大型站点技术架构PDF阅读笔记(一):

    1.数据库读写分离: 2.系统吞吐量和系统并发数以及系统响应时间之间的关系: 3.系统负载的概念: 4.反向代理的概念: 5.使用缓存来读取数据: 6.利用cookie来记录session: 利用co ...

  6. Reveal使用教程

    Reveal使用教程 Reveal是用于透视程序整体结构的一个软件,软件收费89美刀,试用期30天,不过好在有破解版,无需担心花钱的问题​ 在然后呢,软件在哪下,可以在我的github上下载到破解版本 ...

  7. windows编译tensorflow c++库

    1. 准备 windows 10系统.3.6GHz cpu.16G 内存 visual studio 2017 or 2015 下载安装git 下载安装cmake 下载安装swigwin 如果不需要p ...

  8. 广告过滤神器(ADMuncher)4.93

    Ad Muncher 介绍:        浏览网页时,冷不防地被网站播放的MIDI音乐声音吓一跳,或是因为弹出的广告窗口碍事,而影响你上网络的心情.Ad Muncher支持Netscape.Inte ...

  9. USART—串口通讯

    本章中主要讲解的是串口异步通讯,异步通讯中由于没有时钟信号, 所以两个通讯设备之间需要约定好波特率,即每个码元的长度,以便对信号进行解码 . 串口通讯的一个数据包从起始信号开始,直到停止信号结束.数据 ...

  10. maven下载、配置和安装

    Maven简介 #Apache Maven is a software project management and comprehension tool. Based on the concept ...