Giter Club home page Giter Club logo

json-exporter's Introduction

Json Exporter

TravisCI build status Docker Build Statu

This Prometheus exporter operates similar to the Blackbox exporters. It downloads a JSON file and provides a numerical gauge value from within that file. Which value to pick is defined through JsonPath.

Parameters

  • target: URL / Json-file to download
  • jsonpath: the field name to read the value from, this follows the syntax provided by oliveagle/jsonpath

Docker usage

docker build -t json_exporter .
docker run -p 9116:9116 -d json_exporter /json_exporter

To clean up multistage build artifacts afterwards use

docker image prune --filter label=stage=tempbuilder

The related metrics can then be found under:

http://localhost:9116/probe?target=http://validate.jsontest.com/?json=%7B%22key%22:%22value%22%7D&jsonpath=$.parse_time_nanoseconds

Prometheus Configuration

The json exporter needs to be passed the target and the json as a parameter, this can be done with relabelling.

Example config:

scrape_configs:
  - job_name: 'json'
    metrics_path: /probe
    params:
      jsonpath: [$.parse_time_nanoseconds] # Look for the nanoseconds field
    static_configs:
      - targets:
        - http://validate.jsontest.com/?json=%7B%22key%22:%22value%22%7D
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 127.0.0.1:9116  # Json exporter.
    metric_relabel_configs:
      - source_labels: value
        target_label: parse_time

License

MIT License

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.