Skip to content

isometry/platform-health

Repository files navigation

Platform Health

Lightweight & extensible platform health monitoring.

Overview

Platform Health is a simple client/server system for lightweight health monitoring of platform components and systems.

The Platform Health client (phc) sends a gRPC health check request to a Platform Health server which is configured to probe a set of network services. Probes run asynchronously on the server (subject to configurable timeouts), with the accumulated response returned to the client.

Providers

Probes use a compile-time provider plugin system that supports extension to monitoring of arbitrary services. Integrated providers include:

  • satellite: A separate satellite instance of the Platform Health server
  • tcp: TCP connectivity checks
  • tls: TLS handshake and certificate verification
  • http: HTTP(S) queries with status code and certificate verification
  • grpc: gRPC Health v1 service status checks
  • kubernetes: Kubernetes resource existence and readiness
  • helm: Helm release existence and deployment status
  • vault: Vault cluster initialization and seal status

Each provider implements the Instance interface, with the health of each instance obtained asynchronously, and contributing to the overall response.

Installation

macOS/Linux

brew install isometry/tap/platform-health
$ phs -l & sleep 1 && phc && kill %1
{"status":"HEALTHY", "duration":"0.000004833s"}

Kubernetes

Install via helm chart

helm upgrade \
    --install platform-health \
    -n platform-health --create-namespace \
    oci://ghcr.io/isometry/charts/platform-health

Install via kubectl

kubectl create configmap platform-health --from-file=platform-health.yaml=/dev/stdin <<-EOF
  tcp:
    - name: ssh@localhost
      host: localhost
      port: 22
  tls:
    - name: gmail
      host: smtp.gmail.com
      port: 465
  http:
    - name: google
      url: https://google.com
EOF

kubectl create deployment platform-health --image ghcr.io/isometry/platform-health:latest --port=8080

kubectl patch deployment platform-health --patch-file=/dev/stdin <<-EOF
  spec:
    template:
      spec:
        volumes:
          - name: config
            configMap:
              name: platform-health
        containers:
          - name: platform-health
            args:
              - -vv
            volumeMounts:
              - name: config
                mountPath: /config
EOF

kubectl create service loadbalancer platform-health --tcp=8080:8080

Configuration

The Platform Health server reads a simple configuration file, defaulting to platform-health.yaml with the following structure:

<provider>: [<instance>, …]

Example

The following configuration will monitor that /something/ is listening on tcp/22 of localhost; validate connectivity and TLS handshake to the Gmail SSL mail-submission port; and validate that Google is accessible and returning a 200 status code:

tcp:
  - name: ssh@localhost
    host: localhost
    port: 22
tls:
  - name: gmail
    host: smtp.gmail.com
    port: 465
http:
  - name: google
    url: https://google.com