1 运用场景

无人驾驶车辆运行中要记录的经度,纬度,速度,方向,旁边物体的距离等等。每时每刻都要将数据记录下来做分析。
某一个地区的各车辆的行驶轨迹数据

传统证券行业实时交易数据

实时运维监控数据

2 时间序列数据特点

性能好

存储成本低:高效的压缩算法,节省存储空间,有效降低IO

3 后台启动Prometheus

./prometheus --config.file=prometheus.yml &

测试:执行之后还是会弹出提示信息,但是回车或ctrl+c后,该进程并没有被杀死,还是可以访问Prometheus的

[root@localhost prometheus-2.6.1.linux-amd64]# ./prometheus --config.file=prometheus.yml &
[1] 66817
[root@localhost prometheus-2.6.1.linux-amd64]# level=info ts=2022-02-08T08:29:25.148125005Z caller=main.go:243 msg="Starting Prometheus" version="(version=2.6.1, branch=HEAD, revision=b639fe140c1f71b2cbad3fc322b17efe60839e7e)"
level=info ts=2022-02-08T08:29:25.148195298Z caller=main.go:244 build_context="(go=go1.11.4, user=root@4c0e286fe2b3, date=20190115-19:12:04)"
level=info ts=2022-02-08T08:29:25.148210852Z caller=main.go:245 host_details="(Linux 3.10.0-1160.49.1.el7.x86_64 #1 SMP Tue Nov 30 15:51:32 UTC 2021 x86_64 localhost.localdomain (none))"
level=info ts=2022-02-08T08:29:25.148224939Z caller=main.go:246 fd_limits="(soft=1024, hard=4096)"
level=info ts=2022-02-08T08:29:25.148235639Z caller=main.go:247 vm_limits="(soft=unlimited, hard=unlimited)"
level=info ts=2022-02-08T08:29:25.148793611Z caller=main.go:561 msg="Starting TSDB ..."
level=info ts=2022-02-08T08:29:25.151957885Z caller=web.go:429 component=web msg="Start listening for connections" address=0.0.0.0:9090
level=info ts=2022-02-08T08:29:25.18589452Z caller=main.go:571 msg="TSDB started"
level=info ts=2022-02-08T08:29:25.186044958Z caller=main.go:631 msg="Loading configuration file" filename=prometheus.yml
level=info ts=2022-02-08T08:29:25.187174095Z caller=main.go:657 msg="Completed loading of configuration file" filename=prometheus.yml
level=info ts=2022-02-08T08:29:25.187189038Z caller=main.go:530 msg="Server is ready to receive web requests."
^C
[root@localhost prometheus-2.6.1.linux-amd64]#
[root@localhost prometheus-2.6.1.linux-amd64]# lsof -i:9090
COMMAND     PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
prometheu 66817 root    6u  IPv6 617898      0t0  TCP *:websm (LISTEN)
prometheu 66817 root    7u  IPv4 617900      0t0  TCP localhost:50178->localhost:websm (ESTABLISHED)
prometheu 66817 root    8u  IPv6 617901      0t0  TCP localhost:websm->localhost:50178 (ESTABLISHED)
prometheu 66817 root    9u  IPv6 617909      0t0  TCP localhost:49520->localhost:websm (ESTABLISHED)
prometheu 66817 root   10u  IPv6 617910      0t0  TCP localhost:websm->localhost:49520 (ESTABLISHED)
[root@localhost prometheus-2.6.1.linux-amd64]#

4 Prometheus软件界面

4.1 查看监控的机器(监控的目标)

,点Status --》点Targets --》可以看到只监控了本机

查看监控的目标(界面如下):

其默认只监控了本机一台,注意查看时,localhost需要修改为linux的主机地址

图例说明

  1. State:表示当前机器的运行状态,UP代表运行,DOWN代表没有运行

4.2 查看监控的数据

4.3 在web主界面可以通过关键字查询监控项

默认页面:

输入关键字进行查看,这个的输入会有提示的

5 监控远程Linux主机

第一步:安装node组件

在远程linux主机(被监控端agent1)上安装node_exporter组件。其主要作用就是帮助Prometheus收集数据
官方下载地址: https://prometheus.io/download/
链接:https://pan.baidu.com/s/1ABbfa2VuPLYM_KabYMSeJQ
提取码:2g1f

第一步:将下载的node上传到想要收集的Linux机器上

收集每一种信息想要不同的node组件

第二步:解压到对应的目录中

实际操作(一般是解压到usr/local目录下,我这个是解压过了,就步修改了)

[root@localhost ~]# mv node_exporter-0.16.0.linux-amd64.tar.gz /opt/
[root@localhost ~]#
[root@localhost opt]# tar -zxvf node_exporter-0.16.0.linux-amd64.tar.gz
node_exporter-0.16.0.linux-amd64/
node_exporter-0.16.0.linux-amd64/LICENSE
node_exporter-0.16.0.linux-amd64/node_exporter
node_exporter-0.16.0.linux-amd64/NOTICE
[root@localhost opt]# ls
apache-maven-3.5.4                   kibana-7.6.1-linux-x86_64
apache-maven-3.5.4-bin.tar.gz        maven
containerd                           node_exporter-0.16.0.linux-amd64
elasticsearch-7.6.1                  node_exporter-0.16.0.linux-amd64.tar.gz
elasticsearch-analysis-ik-7.4.0      prometheus
elasticsearch-analysis-ik-7.4.0.zip  rh
filebeat
[root@localhost opt]# mv node_exporter-0.16.0.linux-amd64 node_export
[root@localhost opt]# ls
apache-maven-3.5.4                   kibana-7.6.1-linux-x86_64
apache-maven-3.5.4-bin.tar.gz        maven
containerd                           node_export
elasticsearch-7.6.1                  node_exporter-0.16.0.linux-amd64.tar.gz
elasticsearch-analysis-ik-7.4.0      prometheus
elasticsearch-analysis-ik-7.4.0.zip  rh
filebeat
[root@localhost opt]# cd node_export/
[root@localhost node_export]# ls
LICENSE  node_exporter  NOTICE
[root@localhost node_export]#

第三步:在安装目录下运行node_exporter,收集Linux主机信息

nohup ./node_exporter &

nohup:代表会永久的运行下去,除非我们将其停止

第四步:查看是否运行,通过端口查看:lsof -i:9100

lsof -i:9100

执行流程

[root@localhost node_export]# nohup ./node_exporter &
[1] 67601
[root@localhost node_export]# nohup: 忽略输入并把输出追加到"nohup.out"[root@localhost node_export]# lsof -i:9100
COMMAND     PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
node_expo 67601 root    3u  IPv6 629243      0t0  TCP *:jetdirect (LISTEN)
[root@localhost node_export]#

第五步:通过浏览器访问http://被监控端IP:9100/metrics就可以查看到node_exporter在被监控端收集的监控信息

第二步:修改配置信息

第一步中,安装了node_exporter,只是安装,并没有使Prometheus收集到这些信息

回到prometheus服务器的配置文件里添加被监控机器的配置段,在配置文件的最后添加如下内容

  - job_name: 'agent1'static_config:- targets: ['192.168.126.132:9100']

第三步:重启服务

[root@localhost prometheus-2.6.1.linux-amd64]# pkill prometheus
[root@localhost prometheus-2.6.1.linux-amd64]# level=warn ts=2022-02-08T09:35:14.287987247Z caller=main.go:405 msg="Received SIGTERM, exiting gracefully..."
level=info ts=2022-02-08T09:35:14.288075426Z caller=main.go:430 msg="Stopping scrape discovery manager..."
level=info ts=2022-02-08T09:35:14.288098231Z caller=main.go:444 msg="Stopping notify discovery manager..."
level=info ts=2022-02-08T09:35:14.288105588Z caller=main.go:466 msg="Stopping scrape manager..."
level=info ts=2022-02-08T09:35:14.288130775Z caller=main.go:440 msg="Notify discovery manager stopped"
level=info ts=2022-02-08T09:35:14.288115221Z caller=main.go:426 msg="Scrape discovery manager stopped"
level=info ts=2022-02-08T09:35:14.288145369Z caller=manager.go:664 component="rule manager" msg="Stopping rule manager..."
level=info ts=2022-02-08T09:35:14.288154592Z caller=manager.go:670 component="rule manager" msg="Rule manager stopped"
level=info ts=2022-02-08T09:35:14.288156181Z caller=main.go:460 msg="Scrape manager stopped"
level=info ts=2022-02-08T09:35:14.28898856Z caller=notifier.go:521 component=notifier msg="Stopping notification manager..."
level=info ts=2022-02-08T09:35:14.289016013Z caller=main.go:615 msg="Notifier manager stopped"
level=info ts=2022-02-08T09:35:14.289145291Z caller=main.go:627 msg="See you next time!"[1]+  完成                  ./prometheus --config.file=prometheus.yml

确认端口没有进程占用

[root@localhost prometheus-2.6.1.linux-amd64]# lsof -i:9090
[root@localhost prometheus-2.6.1.linux-amd64]#

启动Prometheus

[root@localhost prometheus-2.6.1.linux-amd64]# ./prometheus --config.file=prometheus.yml &
[1] 67831
[root@localhost prometheus-2.6.1.linux-amd64]# level=info ts=2022-02-08T09:37:47.345266924Z caller=main.go:243 msg="Starting Prometheus" version="(version=2.6.1, branch=HEAD, revision=b639fe140c1f71b2cbad3fc322b17efe60839e7e)"
level=info ts=2022-02-08T09:37:47.345336859Z caller=main.go:244 build_context="(go=go1.11.4, user=root@4c0e286fe2b3, date=20190115-19:12:04)"
level=info ts=2022-02-08T09:37:47.345351432Z caller=main.go:245 host_details="(Linux 3.10.0-1160.49.1.el7.x86_64 #1 SMP Tue Nov 30 15:51:32 UTC 2021 x86_64 localhost.localdomain (none))"
level=info ts=2022-02-08T09:37:47.345366609Z caller=main.go:246 fd_limits="(soft=1024, hard=4096)"
level=info ts=2022-02-08T09:37:47.345390694Z caller=main.go:247 vm_limits="(soft=unlimited, hard=unlimited)"
level=info ts=2022-02-08T09:37:47.345997993Z caller=main.go:561 msg="Starting TSDB ..."
level=info ts=2022-02-08T09:37:47.346270607Z caller=repair.go:48 component=tsdb msg="found healthy block" mint=1644301801123 maxt=1644307200000 ulid=01FVCAP8H8Y7N29REN56N45P92
level=info ts=2022-02-08T09:37:47.347426319Z caller=web.go:429 component=web msg="Start listening for connections" address=0.0.0.0:9090
level=info ts=2022-02-08T09:37:47.386462493Z caller=main.go:571 msg="TSDB started"
level=info ts=2022-02-08T09:37:47.386517841Z caller=main.go:631 msg="Loading configuration file" filename=prometheus.yml
level=info ts=2022-02-08T09:37:47.387938336Z caller=main.go:657 msg="Completed loading of configuration file" filename=prometheus.yml
level=info ts=2022-02-08T09:37:47.387957157Z caller=main.go:530 msg="Server is ready to receive web requests."

认端口被占用,说明重启成功

[root@localhost prometheus-2.6.1.linux-amd64]# lsof -i:9090
COMMAND     PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
prometheu 67831 root    6u  IPv6 633287      0t0  TCP *:websm (LISTEN)
prometheu 67831 root    7u  IPv4 633289      0t0  TCP localhost:60874->localhost:websm (ESTABLISHED)
prometheu 67831 root    8u  IPv6 634116      0t0  TCP localhost:websm->localhost:60874 (ESTABLISHED)
[root@localhost prometheus-2.6.1.linux-amd64]#

第五步:查看是否多了一台监控目标

回到web管理界面 --》点Status --》点Targets --》可以看到多了一台监控目标
额,我这个是在配置信息的时候,地址写错了,这里便不改了,各位注意就是了

6 监控其他服务服务

流程与5差不多,就是想要安装不同的node,总结根据需求进行安装即可

Prometheus(3)Prometheus界面概述、监控服务功能实现相关推荐

  1. prometheus和grafana、node_exporter监控服务资源

    1.prometheus 说明:Prometheus是一个开源的系统监控和警报工具包 1.1.输入命令下载Prometheus安装包: wget https://github.com/promethe ...

  2. 体验监控宝免费网站服务器监控服务 附注册账户及网站监控部署方法

    无论是我们个人网站还是公司企业专业运维人员,对于公司服务器.网站等项目肯定不能全天24小时的在线人工监控和管理,尤其是在众多项目部署的时候,我们根本顾及不过来所有项目网站.服务器的稳定性.比如经常有遇 ...

  3. Docker——Prometheus监控服务治理

    摘要 Prometheus是继Kubernetes之后,第二个从云原生计算基金会(CNCF)毕业的项目.Prometheus是Google监控系统BorgMon类似实现的开源版,整套系统由监控服务.告 ...

  4. prometheus:(二)监控概述

    目录 一:监控系统概论 运维监控平台设计思路 二: prometheus基础资源监控 2.1网络监控 2.2存储监控 2.3服务器监控 2.4中间件监控 2.5应用程序监控(APM) 三:常用监控系统 ...

  5. prometheus监控告警功能

    prometheus监控K8S 监控告警功能 alertmanager邮箱告警配置 首先开通SMTP服务,QQ邮箱:设置–帐号–开通POP3/SMTP服务,记住生成的密码(其它邮箱同理) 编辑prom ...

  6. 二进制部署Prometheus及监控服务

    一.部署 Prometheus 1.下载二进制文件 https://github.com/prometheus/prometheus/releases/download/v2.28.0/prometh ...

  7. 阿里云Prometheus监控服务

    什么是Prometheus? Prometheus是一个开源系统监控和警报工具包 原生Prometheus:Overview | Prometheus 工作原理:prometheus原理简介_袁胜的博 ...

  8. Envoy service mesh、Prometheus和Grafana下的微服务监控(翻译)

    原文链接:medium.com/@dnivra26/m- 如果你刚接触"Service Mesh"和"Envoy",我这里有一篇文章可以帮你入门. 这是Envo ...

  9. Prometheus 监控服务端口、网站状态等(黑盒监测)

    1.blackbox_exporter介绍 blackbox_exporter是Prometheus 官方提供的 exporter 之一,可以提供 http.dns.tcp.icmp 的监控数据采集. ...

最新文章

  1. C#操作Excel(读取)
  2. 《C#高级编程》笔记系列第三弹
  3. C++ 重载数学运算符
  4. 字符级Seq2Seq-英语粤语翻译的简单实现
  5. 移位运算符优先级很低
  6. linux php imagick 扩展安装,linux下为php5.3安装Imagick扩展
  7. python入门三:文件操作
  8. 点击弹出一个背景透明(根据页面内容的高度获取这个元素的高度)
  9. BZOJ 1901 Zju2112 Dynamic Rankings 题解
  10. YYKit-YYModel分析
  11. 利用VBA将出纳表格生成可打印的凭证
  12. 电脑本地连接,电脑出现多个“本地连接”的解决方法
  13. [WIN32]MessageBox用法
  14. 【安信可NB-IoT模组EC系列AT指令应用笔记④】将设备位置接入阿里云地图,实现空间数据可视化
  15. python数学公式识别_python用re正则表达式实现数学公式计算
  16. 原创电子书《菜鸟程序员成长之路:从技术小白到阿里巴巴Java工程师》
  17. 北京圣思园JAVA培训教学视频汇总
  18. java mina 服务端_Mina客户端和服务端代码编写
  19. 程序员的算法趣题:Q13 有多少种满足字母算式的解法(Java版)
  20. Python数据类型变量命名format集合等

热门文章

  1. 数据库系统概论(王珊,萨师煊版)范式之前要点一览(简略)
  2. MFC-CString
  3. 我的世界服务器显示弹幕,[娱乐]RaiixDM —— 在mc中接收b站直播弹幕[1.12.x-1.15.x]...
  4. vtk医学图形提取骨骼模型的算法思路
  5. c++/c memcpy函数用法(拷贝数组的内容)
  6. appium使用简记
  7. 人脸识别考勤系统安卓APP(手把手教学-手动滑稽)
  8. 计算机三级网络技术(选择高频考点)
  9. 金蝶K3系统19年度增值税率调整(16改13,10改9)操作步骤
  10. 了解iPhone OS框架