首页 > 其他分享 >Prometheus搭建教程

Prometheus搭建教程

时间:2023-12-30 22:33:50浏览次数:26  
标签:教程 22 prometheus grafana centos7 Prometheus root 1001 搭建

一、部署prometheus

官方文档:https://prometheus.io/docs/introduction/first_steps/

下载地址:https://github.com/prometheus/prometheus/releases

[root@centos7 ~]# tar zxf prometheus-2.45.2.linux-amd64.tar.gz 
[root@centos7 ~]# mv prometheus-2.45.2.linux-amd64 /usr/local/prometheus
[root@centos7 ~]# ll -h /usr/local/prometheus/
total 225M
drwxr-xr-x 2 1001 docker   38 Dec 19 22:31 console_libraries
drwxr-xr-x 2 1001 docker  173 Dec 19 22:31 consoles
-rw-r--r-- 1 1001 docker  12K Dec 19 22:31 LICENSE
-rw-r--r-- 1 1001 docker 3.7K Dec 19 22:31 NOTICE
-rwxr-xr-x 1 1001 docker 116M Dec 19 22:09 prometheus
-rw-r--r-- 1 1001 docker  934 Dec 19 22:31 prometheus.yml
-rwxr-xr-x 1 1001 docker 109M Dec 19 22:10 promtool

systemctl管理prometheus

[root@centos7 ~]# cat > /usr/lib/systemd/system/prometheus.service << EOF
[Unit]
Description=Prometheus
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/prometheus/prometheus \\
--config.file=/usr/local/prometheus/prometheus.yml \\
--storage.tsdb.path=/data/prometheus
[Install]
WantedBy=multi-user.target
EOF

[root@centos7 ~]# systemctl daemon-reload
[root@centos7 ~]# systemctl start prometheus.service 
[root@centos7 ~]# systemctl enable prometheus.service

访问http://localhost:9090/targets

二、部署node_exporter

下载地址:https://github.com/prometheus/node_exporter/releases

[root@centos7 ~]# tar zxf node_exporter-1.7.0.linux-amd64.tar.gz 
[root@centos7 ~]# mv node_exporter-1.7.0.linux-amd64 /usr/local/node_exporter

[root@centos7 ~]# cat > /usr/lib/systemd/system/node_exporter.service << EOF
[Unit]
Description=node_exporter
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/node_exporter/node_exporter
[Install]
WantedBy=multi-user.target
EOF

[root@centos7 ~]# systemctl start node_exporter.service 
[root@centos7 ~]# systemctl enable node_exporter.service

三、安装grafana

下载地址:https://grafana.com/grafana/download

官方文档:https://grafana.com/docs/grafana/latest/setup-grafana/installation/

[root@centos7 ~]# yum localinstall -y grafana-7.3.3-1.x86_64.rpm
[root@centos7 ~]# systemctl start grafana-server.service
[root@centos7 ~]# systemctl enable grafana-server.service
[root@centos7 ~]# netstat -lnpt|grep 3000 
tcp6     0      0 :::3000      :::*      LISTEN      3307/grafana-server

访问http://localhost:3000,默认帐密是admin/admin

四、grafana出图

初次访问grafana主页,会提示修改密码,也可跳过,后续再改

1. 配置数据源

2. 创建仪表板

 

标签:教程,22,prometheus,grafana,centos7,Prometheus,root,1001,搭建
From: https://www.cnblogs.com/niuyx/p/17935958.html

相关文章

  • 无涯教程-Java 正则 - Matcher boolean lookingAt函数
    java.time.Matcher.lookingAt()方法尝试从区域的开头开始将输入序列与模式进行匹配。booleanlookingAt()-声明以下是java.time.Matcher.lookingAt()方法的声明。publicbooleanlookingAt()booleanlookingAt()-返回值当且仅当输入序列的前缀与此匹配器的模式匹配时,......
  • 无涯教程-Java 正则 - Matcher boolean hasTransparentBounds()函数
    java.time.Matcher.hasTransparentBounds()方法查询此匹配器的区域边界。booleanhasTransparentBounds()-声明以下是java.time.Matcher.hasTransparentBounds()方法的声明。publicbooleanhasTransparentBounds()booleanhasTransparentBounds()-返回值如果此匹配器......
  • Python教程(18)——python文件操作详解
    所谓的文件操作是指对计算机中的文件进行读取、写入、修改和删除等操作。简单来说可以分为以下三个部分:打开文件操作文件关闭文件就是这三个简简单单的操作,却在计算机世界占有一席之地。打开文件有各种打开模式,各不相同;操作文件,有读写模式;关闭文件就比较简单了。Python文......
  • 无涯教程-Java 正则 - Matcher boolean hasAnchoringBounds()函数
    java.time.Matcher.hasAnchoringBounds()方法查询此匹配器的区域边界定位。booleanhasAnchoringBounds()-声明以下是java.time.Matcher.hasAnchoringBounds()方法的声明。publicbooleanhasAnchoringBounds()booleanhasAnchoringBounds()-返回值如果此匹配器使用锚......
  • Golang开发环境搭建-Vim篇
    本文于2017年3月份完成,发布在个人博客网站上。考虑个人博客因某种原因无法修复,于是在博客园安家,之前发布的文章逐步搬迁过来。最近在研究docker的使用方法,恰好手边有一本docker源码分析的书,所以在ubuntu环境下准备了一套golang的开发环境,便于在学习docker使用的时候顺便学习gol......
  • 无涯教程-Java 正则 - Matcher int groupCount函数
    java.time.Matcher.groupCount()方法返回此匹配器模式中的捕获组数。intgroupCount()-声明以下是java.time.Matcher.groupCount()方法的声明。publicintgroupCount()intgroupCount()-返回值此匹配器模式中的捕获组数。intgroupCount()-示例下面的示例显示jav......
  • 无涯教程-Java 正则 - Matcher String group(String name)函数
    java.time.Matcher.group(Stringname)方法返回在上一次匹配操作期间给定组捕获的输入子序列。Stringgroup(Stringname)-声明以下是java.time.Matcher.group(Stringname)方法的声明。publicStringgroup(intgroup)group - 该匹配器模式中捕获组的索引。String......
  • 前端环境搭建到创建vue项目运行
    整体流程1.安装nvm管理工具,用于管理node的版本方便node版本的切换a.下载nvm1.官方下载地址:https://github.com/coreybutler/nvm-windows/releases2.备用下载地址:https://xiaocai1688.lanzouw.com/b04wvgimj密码:h33mb.直接双击安装,验证安装成功输入命令nvm-v......
  • 无涯教程-Java 正则 - Matcher String group函数
    java.time.Matcher.group()方法尝试查找与模式匹配的输入序列的下一个子序列。Stringgroup()-声明以下是java.time.Matcher.group()方法的声明。publicStringgroup()Stringgroup()-返回值与上一个匹配项匹配的(可能为空)子序列,为字符串形式。IllegalStateExcep......
  • 无涯教程-Java 正则 - Matcher boolean find(int start)函数
    java.time.Matcher.find(intstart)方法将重置匹配器,然后尝试从指定的索引开始查找与模式匹配的输入序列的下一个子序列。booleanfind(intstart)-声明以下是java.time.Matcher.find(intstart)方法的声明。publicbooleanfind(intstart)start  - 输入字符串中的......