Skip to content

LuxChanLu/freshping-prometheus-exporter

Repository files navigation

Freshping prometheus exporter

Build Status Codacy Badge GitHub release Go Report Card go-doc Docker Pulls Docker Image Size (latest by date)

This is a simple prometheus exporter for freshping.io

Configuration

You first need to have a status page enable (This exporter use the status page api)

To run you only need to provide one of these envionment variables :

  • FRESHPING_URL : URL to your status page (https://statuspage.freshping.io/XXXXX-XXXXX/)
  • FRESHPING_URL_FILE : A file containing the URL (In case you want to use a vault with secrets if your url have an url or password https://username:[email protected]/XXXXX-XXXXX/)

Kubernetes

(You can add the prometheus.io/scrape if your deployment use it)

apiVersion: apps/v1
kind: Deployment
metadata:
  name: freshping-exporter
  labels:
    app.kubernetes.io/name: freshping-exporter
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: freshping-exporter
  template:
    metadata:
      labels:
        app.kubernetes.io/name: freshping-exporter
    spec:
      containers:
      - name: freshping-exporter
        image: luxchan/freshping-prometheus-exporter:<VERSION>
        env:
          - name: FRESHPING_URL
            value: https://statuspage.freshping.io/XXXXX-XXXXX/
        resources:
          requests:
            memory: "64Mi"
            cpu: "50m"
          limits:
            memory: "128Mi"
            cpu: "150m"
        ports:
        - containerPort: 9705
          protocol: TCP
          name: metrics
        securityContext:
          readOnlyRootFilesystem: true
          allowPrivilegeEscalation: false
          privileged: false
          capabilities:
            drop:
              - ALL
      securityContext:
        runAsNonRoot: true
        runAsUser: 10001

And if needed the Service and ServiceMonitor

---
apiVersion: v1
kind: Service
metadata:
  name: freshping-exporter
  labels:
    app.kubernetes.io/name: freshping-exporter
spec:
  selector:
    app.kubernetes.io/name: freshping-exporter
  ports:
  - port: 9705
    targetPort: 9705
    name: metrics
    protocol: TCP
---
kind: ServiceMonitor
apiVersion: monitoring.coreos.com/v1
metadata:
  name: freshping-exporter
  labels:
    app.kubernetes.io/name: freshping-exporter
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: freshping-exporter
  jobLabel: app.kubernetes.io/name
  endpoints: 
  - port: "metrics"
    targetPort: 9705
    interval: 15s

Need more than one status page ? Add a container into your deployment and a port into your service