Git Product home page Git Product logo

kube-prometheus-pushgateway's Introduction

kube-prometheus-pushgateway

Kubernetes Prometheus Pushgateway in Jsonnet format as a reusable component.

It is aimed to be used and consumbed by coreos/kube-prometheus

Usage

Use this package in your own infrastructure using jsonnet-bundler:

jb install github.com/latchmihay/kube-prometheus-pushgateway/prometheus-pushgateway

An example of how to use it could be: (save as example.jsonnet)

local kp =
  (import "prometheus-pushgateway/pushgateway.libsonnet") +
  {
    _config+:: {
      namespace: 'monitoring',
    },
  };

{ ['prometheus-pushgateway-' + name]: kp.pushgateway[name], for name in std.objectFields(kp.pushgateway) }

This builds a Prometheus Push Gateway stack

Simply run:

$ jsonnet -J vendor example.jsonnet

Quickstart

This quickstart requires the kube-prometheus to already be deployed and running.

Running this one command should then be enough:

make deploy

Generate Yamls (Similar to the way kube-prometheus works)

go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb
go get github.com/brancz/gojsontoyaml
cd prometheus-pushgateway && jb install && cd ..
rm -rf manifests
mkdir manifests
jsonnet -J prometheus-pushgateway/vendor  -m manifests example.jsonnet | xargs -I{} sh -c 'cat {} | gojsontoyaml > {}.yaml; rm -f {}' -- {}
cat manifests/*

Usage along side kube-prometheus

git clone https://github.com/coreos/kube-prometheus.git
cd kube-prometheus
jb install github.com/latchmihay/kube-prometheus-pushgateway/prometheus-pushgateway
cat > withPromGateway.jsonnet <<EOF
local kp =
  (import 'kube-prometheus/kube-prometheus.libsonnet') +
  (import "prometheus-pushgateway/pushgateway.libsonnet") +
  {
    _config+:: {
      namespace: 'monitoring',
    },
  };

{ ['prometheus-pushgateway-' + name]: kp.pushgateway[name], for name in std.objectFields(kp.pushgateway) } +
{ ['00namespace-' + name]: kp.kubePrometheus[name] for name in std.objectFields(kp.kubePrometheus) } +
{ ['0prometheus-operator-' + name]: kp.prometheusOperator[name] for name in std.objectFields(kp.prometheusOperator) } +
{ ['node-exporter-' + name]: kp.nodeExporter[name] for name in std.objectFields(kp.nodeExporter) } +
{ ['kube-state-metrics-' + name]: kp.kubeStateMetrics[name] for name in std.objectFields(kp.kubeStateMetrics) } +
{ ['alertmanager-' + name]: kp.alertmanager[name] for name in std.objectFields(kp.alertmanager) } +
{ ['prometheus-' + name]: kp.prometheus[name] for name in std.objectFields(kp.prometheus) } +
{ ['prometheus-adapter-' + name]: kp.prometheusAdapter[name] for name in std.objectFields(kp.prometheusAdapter) } +
{ ['grafana-' + name]: kp.grafana[name] for name in std.objectFields(kp.grafana) }
EOF
./build.sh withPromGateway.jsonnet

# everything is at manifests folder

Usage along side kube-prometheus in a container

git clone https://github.com/coreos/kube-prometheus.git
cd kube-prometheus
cat > withPromGateway.jsonnet <<EOF
local kp =
  (import 'kube-prometheus/kube-prometheus.libsonnet') +
  (import "prometheus-pushgateway/pushgateway.libsonnet") +
  {
    _config+:: {
      namespace: 'monitoring',
    },
  };

{ ['prometheus-pushgateway-' + name]: kp.pushgateway[name], for name in std.objectFields(kp.pushgateway) } +
{ ['00namespace-' + name]: kp.kubePrometheus[name] for name in std.objectFields(kp.kubePrometheus) } +
{ ['0prometheus-operator-' + name]: kp.prometheusOperator[name] for name in std.objectFields(kp.prometheusOperator) } +
{ ['node-exporter-' + name]: kp.nodeExporter[name] for name in std.objectFields(kp.nodeExporter) } +
{ ['kube-state-metrics-' + name]: kp.kubeStateMetrics[name] for name in std.objectFields(kp.kubeStateMetrics) } +
{ ['alertmanager-' + name]: kp.alertmanager[name] for name in std.objectFields(kp.alertmanager) } +
{ ['prometheus-' + name]: kp.prometheus[name] for name in std.objectFields(kp.prometheus) } +
{ ['prometheus-adapter-' + name]: kp.prometheusAdapter[name] for name in std.objectFields(kp.prometheusAdapter) } +
{ ['grafana-' + name]: kp.grafana[name] for name in std.objectFields(kp.grafana) }
EOF

docker run --rm -v $(pwd):$(pwd) --workdir $(pwd) quay.io/coreos/jsonnet-ci jb install github.com/latchmihay/kube-prometheus-pushgateway/prometheus-pushgateway

docker run --rm -v $(pwd):$(pwd) --workdir $(pwd) quay.io/coreos/jsonnet-ci ./build.sh withPromGateway.jsonnet

# all the yamls are in the manifests folder

kube-prometheus-pushgateway's People

Contributors

latchmihay avatar tome25 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

kube-prometheus-pushgateway's Issues

Prometheus not discovering prometheus-pushgateway

I tried installing prometheus pushgateway using this repo. Everything went fine. But pushgateway was not showing up in prometheus targets. Upon debugging I saw that the endpoint object prometheus-pushgateway was empty. This is becuase ther service definition of prometheus-pushgateway was pointing the target port as http whereas it should've been 9091 or the named port metrics.

I think the issue is in this specific line -

local pushgatewayPort = servicePort.newNamed('http', $._config.pushgateway.port, 'http');

I think it should be:
local pushgatewayPort = servicePort.newNamed('http', $._config.pushgateway.port, 'metrics');

Latest kube prometheus

docker run --rm -v $(pwd):$(pwd) --workdir $(pwd) quay.io/coreos/jsonnet-ci jb install github.com/latchmihay/kube-prometheus-pushgateway/prometheus-pushgateway
jb: error: invalid character 'l' looking for beginning of value

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.