首页 > 其他分享 >prometheus docker部署安装

prometheus docker部署安装

时间:2023-11-03 17:45:19浏览次数:32  
标签:name 部署 grafana prometheus docker 官网 安装

prometheus prometheus docker部署安装

之前用docker-compose部署过一套自动注册的prometheus,也用k8s的operator部署过一套,详情见promethues栏的文档。
时隔许久,今天在自己虚拟机部署一套promethues玩玩

准备工作

准备三台虚拟机,规格均为 1C 2G 20G,因为是自己玩,所以对性能啥的不要求了。
192.168.40.131 prometheus
192.168.40.132 node-exporter
192.168.40.133 grafana

安装promethues

之前安装prometheus,都是百度文档安装或者自己写dockerfile打镜像。这次安装尽量就别到处搜了,直接看官网。
题外话,官网的文档永远都是最正规的。你宁肯不相信官方也要相信一个不认识的人乱说吗?对吧

prometheus安装官网地址: https://prometheus.io/docs/prometheus/latest/installation/

但是官网提供的有一些瑕疵个人感觉,所以对命令做了些调整

#文件夹创建及授权
mkdir -p /usr/local/prometheus/;chmod 777 -R /usr/local/prometheus
#创建并挂载暴露端口
docker run  -itd --name prometheus  -p 9090:9090  -v /etc/localtime:/etc/localtime:ro     -v /usr/local/prometheus/conf:/etc/prometheus  -v /usr/local/prometheus/data:/prometheus prom/prometheus

运行后应该是报错退出的状态,因为在conf下面没有配置文件,我们可以在官网找一个最基础的配置拷贝到本地的 /usr/local/prometheus/conf 下面并给可读权限

安装node-exporter

同样去看官网吧,官网地址:
https://prometheus.io/docs/instrumenting/exporters/

这里提供了各种各样的exporter,可以根据自己需求点击跳转到github。根据Readme安装,我这也做了下优化

docker run -d --name node-exporter -p 9100:9100  --net="host"   --pid="host"  -v "/etc/localtime:/etc/localtime:ro"  -v "/:/host:ro,rslave"   quay.io/prometheus/node-exporter:latest   --path.rootfs=/host

启动后修改prometheus配置

scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: "centos-40.132"
    static_configs:
      - targets: ["192.168.40.132:9100"]
  - job_name: "prometheus"
    static_configs:
      - targets: ["127.0.0.1:9090"]

别忘了重启prometheus

安装grafana

官网地址: https://grafana.com/docs/grafana/latest/

配置

最后配置部分是在grafana页面配置的,比较简单这里不再罗列
grafana在官网也提供了各式各样的dashboard共别人选择
官网地址: https://grafana.com/grafana/dashboards/?plcmt=footer
在页面import张贴id号即可引入

标签:name,部署,grafana,prometheus,docker,官网,安装
From: https://www.cnblogs.com/liwenchao1995/p/17808076.html

相关文章

  • prometheus Error on ingesting samples that are too old or a re too far into the
    目录prometheusErroroningestingsamplesthataretoooldoraretoofarintothefuture磁盘问题时间问题版本问题历史prometheus旧数据prometheusErroroningestingsamplesthataretoooldoraretoofarintothefuture之前在自己服务器上用docker部署过一个p......
  • haproxy+keepalived部署高可用k8s集群
    四台机器节点名称节点ip节点角色基础配置1、升级机器内核2、将机器ip名称写入到/etc/hosts中3、基础环境准备#关闭防火墙,selinuxsystemctlstopfirewalldsystemctldisablefirewalldsed-i's/enforcing/disabled/'/etc/selinux/configsetenforce0##关闭swaps......
  • Ubuntu系统下安装Dockers
    1、更新系统软件包在安装Docker前,首先需要更新系统软件包,确保系统上的软件都是最新的版本。可以使用以下命令来更新系统:sudoaptupdatesudoaptupgrade2、安装DockerCEDocker提供了不同版本的安装包,分为社区版(CommunityEdition,简称CE)和企业版(EnterpriseEdi......
  • RKE2 部署K8S1.28.x 高可用集群
    标签(空格分隔):kubernetes系列一:RKE2的介绍k8s官方部署安装集群的是使用kubeadm方式,但是该方式比较复杂繁琐,所以产生了一些新的部署安装集群方式,比如k3s和rke2等新方式k3s有着非常庞大的社区支持,部署安装也非常简单,设计为轻量级的k8s,可以很好的运行在物联网设备或者边缘计算......
  • Prometheus接入(四、Spring Boot接入)
    环境CentOS7.9+SpringBoot2.6.8安装1、依赖引入<!--预设监控--><dependency><groupId>io.micrometer</groupId><artifactId>micrometer-registry-prometheus</artifactId></depen......
  • Centos7安装Docker
    在CentOS7上安装Docker需要以下步骤:更新系统:使用以下命令更新CentOS系统,确保已经安装了最新的软件包和依赖项。sudoyumupdate安装Docker依赖项:Docker运行需要一些依赖项,使用以下命令安装这些依赖项。sudoyuminstall-yyum-utilsdevice-mapper-persistent-da......
  • Linux环境Prometheus接入(三、MySQL监控接入mysqld_exporter)
    环境CentOS7.9安装1、命令下载wgethttps://github.com/prometheus/mysqld_exporter/releases/download/v0.15.0/mysqld_exporter-0.15.0.linux-amd64.tar.gztar-zxfmysqld_exporter-0.15.0.linux-amd64.tar.gzmvmysqld_exporter-0.15.0.linux-amd64.tar.gz/home/mysq......
  • Linux环境Prometheus接入(四、系统监控接入node_exporter)
    环境CentOS7.9安装1、命令下载wgethttps://github.com/prometheus/node_exporter/releases/download/v1.6.1/node_exporter-1.6.1.linux-amd64.tar.gztar-zxfnode_exporter-1.6.1.linux-amd64.tar.gzmvnode_exporter-1.6.1.linux-amd64/home/node_exporter2、配置系......
  • Linux环境Prometheus接入(一、Prometheus安装)
    环境CentOS7.9安装1、自行下载https://prometheus.io/download/2、命令下载wgethttps://github.com/prometheus/prometheus/releases/download/v2.47.2/prometheus-2.47.2.linux-amd64.tar.gz3、解压tar-zvfprometheus-2.47.2.linux-amd64.tar.gzmvprometheus-2.......
  • Linux环境Prometheus接入(二、Grafana安装)
    环境CentOS7.9安装1、命令下载yuminstall-yhttps://dl.grafana.com/enterprise/release/grafana-enterprise-10.2.0-1.x86_64.rpm2、启动、查看状态systemctlstartgrafana-serversystemctlstatusgrafana-server-l3、修改启动端口cd/etc/grafanavigrafa......