Prometheus Pushgateway: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 47: Line 47:
curl http://localhost:9091/metrics/
curl http://localhost:9091/metrics/
</syntaxhighlight>
</syntaxhighlight>
==Health==
==Query Health==
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
curl http://localhost:9091/-/healthy
curl http://localhost:9091/-/healthy
</syntaxhighlight>
</syntaxhighlight>
==Readiness==
==Query Readiness==
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>
curl http://localhost:9091/-/ready
curl http://localhost:9091/-/ready
</syntaxhighlight>
</syntaxhighlight>
==Configure Pushgateway as a Prometheus Target==

Revision as of 20:17, 14 October 2020

External

Internal

Overview

Push gateways are used in case of applications or short-lived jobs that do not export metrics directly.

Installation

Kubernetes

apiVersion: v1
kind: Pod
metadata:
  name: 'pushgateway'
  labels:
    function: 'pushgateway'
spec:
  containers:
  - name: 'pushgateway'
    image: prom/pushgateway
---
apiVersion: v1
kind: Service
metadata:
  name: 'pushgateway'
spec:
  type: 'LoadBalancer'
  selector:
    function: 'pushgateway'
  ports:
    - name: 'pushgateway'
      protocol: 'TCP'
      port: 9091
      targetPort: 9091

Playground

https://github.com/ovidiuf/playground/tree/master/prometheus/pushgateway

Operations

Push a Metric Sample

echo "some_metric 3.14" | curl --data-binary @- http://localhost:9091/metrics/job/some_job

Query Metrics

curl http://localhost:9091/metrics/

Query Health

curl http://localhost:9091/-/healthy

Query Readiness

curl http://localhost:9091/-/ready

Configure Pushgateway as a Prometheus Target