Coder Social home page Coder Social logo

madskristiansen / pushprox Goto Github PK

View Code? Open in Web Editor NEW

This project forked from prometheus-community/pushprox

0.0 2.0 0.0 2.28 MB

Proxy to allow Prometheus to scrape through NAT etc.

License: Apache License 2.0

Go 92.06% Dockerfile 1.47% Shell 3.83% Makefile 2.63%

pushprox's Introduction

HELLO WORLD

PushProx CircleCI

PushProx is a client and proxy that allows transversing of NAT and other similar network topologies by Prometheus, while still following the pull model.

While this is reasonably robust in practice, this is a work in progress.

Running

First build the proxy and client:

git clone https://github.com/prometheus-community/pushprox.git
cd pushprox
make build

Run the proxy somewhere both Prometheus and the clients can get to:

./pushprox-proxy

On every target machine run the client, pointing it at the proxy:

./pushprox-client --proxy-url=http://proxy:8080/

In Prometheus, use the proxy as a proxy_url:

scrape_configs:
- job_name: node
  proxy_url: http://proxy:8080/
  static_configs:
    - targets: ['client:9100']  # Presuming the FQDN of the client is "client".

If the target must be scraped over SSL/TLS, add:

  params:
    _scheme: [https]

rather than the usual scheme: https. Only the default scheme: http works with the proxy, so this workaround is required.

Service Discovery

The /clients endpoint will return a list of all registered clients in the format used by file_sd_configs. You could use wget in a cronjob to put it somewhere file_sd_configs can read and then then relabel as needed.

How It Works

Sequence diagram

Clients perform scrapes in a network environment that's not directly accessible by Prometheus. The Proxy is accessible by both the Clients and Prometheus. Each client is identified by its fqdn.

For example, the following sequence is performed when Prometheus scrapes target fqdn-x via PushProx. First, a Client polls the Proxy for scrape requests, and includes its fqdn in the poll (1). The Proxy does not respond yet. Next, Prometheus tries to scrape the target with hostname fqdn-x via the Proxy (2). Using the fqdn received in (1), the Proxy now routes the scrape to the correct Client: the scrape request is in the response body of the poll (3). This scrape request is executed by the client (4), the response containing metrics (5) is posted to the Proxy (6). On its turn, the Proxy returns this to Prometheus (7) as a reponse to the initial scrape of (2).

PushProx passes all HTTP headers transparently, features like compression and accept encoding are up to the scraping Prometheus server.

Security

There is no authentication or authorisation included, a reverse proxy can be put in front though to add these.

Running the client allows those with access to the proxy or the client to access all network services on the machine hosting the client.

pushprox's People

Contributors

brian-brazil avatar superq avatar rollulus avatar conr avatar glaslos avatar madskristiansen avatar snarlysodboxer avatar cho45 avatar toerb avatar prombot avatar ondravondra avatar ecksun avatar davidmankin avatar silex avatar tsnoam avatar bekriebel avatar benclapp avatar troyanov avatar

Watchers

James Cloos avatar  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.