基于Grafana+Prometheus监控thinglinks平台各类数据指标

xiaonannet 2022-05-19 16:49:24

目录

 

基于Grafana+Prometheus监控thinglinks平台各类数据指标

Grafana+Prometheus部署安装配置

拉取镜像包

启动node-exporter

启动prometheus

启动grafana

指标数据接入待更新


 

基于Grafana+Prometheus监控thinglinks平台各类数据指标

Grafana+Prometheus部署安装配置

拉取镜像包

docker pull prom/node-exporter

docker pull prom/prometheus

docker pull grafana/grafana

 

 

启动node-exporter

docker run -d -p 9100:9100  -v "/proc:/host/proc:ro"  -v "/sys:/host/sys:ro"  -v "/:/rootfs:ro"  --net="host"  prom/node-exporter

 

等待几秒钟,查看端口是否起来了(注意放行安全组)

 

 

 

访问URL:http://127.0.0.1:9100/metrics

 

 

 

 

新建目录prometheus,编辑配置文件prometheus.yml
mkdir /data/docker/prometheus 
cd /data/docker/prometheus/
vim prometheus.yml

 

prometheus.yml

 

global:
  scrape_interval: 3s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
alerting:
  alertmanagers:
    - static_configs:
        - targets:
          # - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: "prometheus"

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ["127.0.0.1:9090"]
      
  - job_name: "linux"
    static_configs:
      - targets: ["127.0.0.1:9100"]
        labels:
          instance: localhost
          
  - job_name: "thinglinks-mqtt"
    metrics_path: /broker/smqtt/meter
    static_configs:
      - targets: ["127.0.0.1:19100"] # 后台服务地址

 

注意IP地址的替换

 

 

启动prometheus

 

docker run -d  -p 9090:9090  -v /data/docker/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml  prom/prometheus

 

 

 

 

访问URL:http://127.0.0.1:9090/graph

 

 

 

访问targetsURL:http://127.0.0.1:9090/targets

 

 

如果状态没有UP起来,等待一会,就会UP了

 

启动grafana

 

 

新建目录
mkdir /data/docker/grafana-storage
因为grafana用户会在这个目录写入文件,直接设置777,比较简单粗暴!
chmod 777 -R /data/docker/grafana-storage
启动
docker run -d  -p 9091:3000  --name=grafana  -v /data/docker/grafana-storage:/var/lib/grafana  grafana/grafana

 

 

访问http://127.0.0.1:9091/ 默认账号admin  密码admin

 

 

 

指标数据接入待更新

...全文
485 回复 打赏 收藏 举报
写回复
回复
切换为时间正序
请发表友善的回复…
发表回复
发帖
ThingLinks社区

303

社区成员

ThingLinks物联网一体化平台社区 版本将持续迭代更新,支持商业二开; 欢迎你分享物联网及平台相关技术文档;
物联网能源开源 企业社区
社区管理员
  • xiaonannet
  • jian436
  • 很久是多久
加入社区
帖子事件
创建了帖子
2022-05-19 16:49
社区公告

ThingLinks物联网一体化平台社区

https://gitee.com/mqttsnet/thinglinks

https://github.com/mqttsnet/thinglinks