zoukankan      html  css  js  c++  java
  • grafana+prometheus+node_exporter+linux

    使用Grafana和Prometheus对Linux服务器性能进行监控,主要通过node_exporter进行监控,指标如 CPU、内存、磁盘等。Prometheus通过HTTP协议从远程的机器收集数据并存储Prometheus本地时序数据库。

    一.监测服务器安装node_exporter

    linux下载: wget https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz

    解压:tar xzvf node_exporter-0.18.1.linux-amd64.tar.gz
      cd node_exporter-0.18.1.linux-amd64
    启动:./node_exporter 


    二.本地安装prometheus,修改监测配置

    1.下载并解压:https://prometheus.io/download/

    2.解压后打开,prometheus.yml

    # my global config
    global:
      scrape_interval:     15s # 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: ['localhost:9090']

    在末尾加上监测的ip和端口
    - job_name: 'linux-exporter' metrics_path: /metrics static_configs: - targets: ['xxx.xxx.xxx.xxx:9100']

    3.监测是否监听成功

    启动prometheus.exe,本地访问:localhost:9090

     

     界面展示监听的服务器即表示成功~~~~


    三.安装
    grafana
    1.下载:https://grafana.com/grafana/download
    2.启动:本地访问localhost:3000
    默认admin/admin登录,登录进去会让你修改用户名和密码,修改即可
    3.选择Prometheus数据源

     

     

     

    4.进入grafana官网 https://grafana.com/,从菜单栏Grafana中选择Dashboards,进入dashboards模板页面,复制ID,这里用的是8919,在grafana上ipmort 监听模块:

     
    
    
    
     
    
    
    

  • 相关阅读:
    模拟ORA-26040: Data block was loaded using the NOLOGGING option
    poj 2752 Seek the Name, Seek the Fame (KMP纯模版)
    一入python深似海--变量和对象
    Codeforces 448 C. Painting Fence
    Unix网络编程 高级IO套接字设置超时
    [ JavaScript ] JavaScript 实现继承.
    讲座:与迷茫为友的成长
    分享:进化版动漫更新提醒(微信及软件)
    设计模式------模板方法模式
    BasePath问题-nginx负载均衡配置
  • 原文地址:https://www.cnblogs.com/jiangger/p/13999615.html
Copyright © 2011-2022 走看看