Giter VIP home page Giter VIP logo

cmd-exporter's Introduction

cmd-exporter

说明

将命令行执行结果作为指标通过exporter暴露出去。

  • 使用java实现
  • 指标类型为Gauge,只支持返回值为数值的命令
  • 支持添加labels

配置

.yml文件完成配置,说明如下:

port: 8888 #端口

commands: # 命令指标列表
  - name: "kafka_up_status" # 指标名称 
    cmd: "ps -ef|grep kafka|grep -v grep|wc -l" # 命令
    labels: # 标签列表
      host: "kafka1" # k/v
    

使用

  1. 打包mvn clean install
  2. 准备配置文件application.yml
    port: 8888 #端口
    
    commands: # 命令指标列表
      - name: "kafka_up_status" # 指标名称 
        cmd: "ps -ef|grep kafka|grep -v grep|wc -l" # 命令
        labels: # 标签列表
          host: "kafka1" # k/v    
    
  3. 启动exporter
    # 将配置文件路径作为参数传入
    nohup java -cp cmd-exporter-1.0-SNAPSHOT.jar \
     com.prometheus.exporter.Server /application.yml > nohup.txt 2>&1 &
    
  4. 获取指标
    curl localhost:7998/metrics
    

cmd-exporter's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.