Categorygithub.com/DazWilkin/gcp-status
modulepackage
0.0.0-20240903172117-f8961d6e2b68
Repository: https://github.com/dazwilkin/gcp-status.git
Documentation: pkg.go.dev

# README

GCP Status Exporter

build-container Go Reference Go Report Card

Converts Google Cloud Status Dashboard into a series of up metrics (by services) for Prometheus consumption.

# HELP gcp_status_build_info A metric with a constant '1' value labeled by OS version, Go version, and the Git commit of the exporter
# TYPE gcp_status_build_info counter
gcp_status_build_info{git_commit="",go_version="go1.18",os_version=""} 1
# HELP gcp_status_services Count of GCP service availability
# TYPE gcp_status_services gauge
gcp_status_services{region="Americas"} 94
gcp_status_services{region="Asia Pacific"} 85
gcp_status_services{region="Europe"} 95
gcp_status_services{region="Global"} 61
gcp_status_services{region="Multi-regions"} 21
# HELP gcp_status_services_total Count of GCP services
# TYPE gcp_status_services_total gauge
gcp_status_services_total 138
# HELP gcp_status_start_time Exporter start time in Unix epoch seconds
# TYPE gcp_status_start_time gauge
gcp_status_start_time 1.659727534e+09
# HELP gcp_status_up Status of GCP service (1=Available; 0=Unavailable)
# TYPE gcp_status_up gauge
gcp_status_up{region="Americas",service="Artifact Registry"} 1
gcp_status_up{region="Asia Pacific",service="Artifact Registry"} 1
gcp_status_up{region="Europe",service="Artifact Registry"} 1
gcp_status_up{region="Multi-regions",service="Artifact Registry"} 1
gcp_status_up{region="Americas",service="Google Kubernetes Engine"} 1
gcp_status_up{region="Asia Pacific",service="Google Kubernetes Engine"} 1
gcp_status_up{region="Europe",service="Google Kubernetes Engine"} 1

Metrics

All metric names are prefix gcp_status_

NameTypeLabelsDescription
build_infoCountergit_commit,go_version,os_versionThe status of the Exporter (1=available)
servicesGaugeregionThe count of Google Cloud services by region
services_totalGaugeThe count of Google Cloud services
upGaugeregion,serviceThe status of the service in the region (1=available;0=down)

Rules

If the listed Americas-based services are down for 15 minutes as measured in 5-minute chunks

- alert: gcp_status_up_down_americas
  expr: |
    min_over_time(
      gcp_status_up{
        region="Americas",
        service=~"Artifact Registry|Google Compute Engine|Google Kubernetes Engine|Cloud Firestore|Google Cloud Functions|Cloud Run|Google Cloud Scheduler"
      }[5m])<1
  for: 15m
  labels:
    severity: page
  annotations:
    summary: GCP Status service {{ $labels.service }} down in {{ $labels.region }}

If the listed Global services are down for 15 minutes as measured in 5-minute chunks

- alert: gcp_status_up_down_global
  expr: |
    min_over_time(
      gcp_status_up{
        region="Global",
        service=~"Cloud Endpoints|Cloud Logging|Cloud Monitoring|Cloud Profiler"
        }[5m])<1
  for: 15m
  labels:
    severity: page
  annotations:
    summary: GCP Status service {{ $labels.service }} down in {{ $labels.region }}

Run

Go

go run .

Docker

docker run \
--interactive --tty --rm \
ghcr.io/dazwilkin/gcp-status:1feb45d4fcef9efcd6087940bf2020e7879d4277 \
--endpoint=:9989 \
--path=/metrics

Docker Compose

gcp-exporter:
  image: ghcr.io/dazwilkin/gcp-status:1feb45d4fcef9efcd6087940bf2020e7879d4277
  container_name: gcp-status
  expose:
  - "9989" # GCP Status port registered on Prometheus Wiki
  ports:
  - 9989:9989


Buy Me A Coffee

# Functions

No description provided by the author
NewExporterCollector returns a new ExporterCollector.
NewService is a function that returns a new Service.
NewStatusCollector returns a new StatusCollector.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

GitCommit is the git commit value and is expected to be set during build.
GoVersion is the Golang runtime version.
OSVersion is the OS version (uname --kernel-release) and is expected to be set during build.
StartTime is the start time of the exporter represented as a UNIX epoch.

# Structs

No description provided by the author
ExporterCollector collects metrics, mostly runtime, about this exporter in general.
Service describes a Google Cloud Platform service status.
StatusCollector represents GCP status dashboard.

# Type aliases

Region is Google Cloud region.
No description provided by the author
No description provided by the author