• Stars
    star
    160
  • Rank 234,703 (Top 5 %)
  • Language
    Go
  • License
    MIT License
  • Created over 5 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Utility that exposes the expiry of TLS certificates as Prometheus metrics

Utility that exposes the expiry of TLS certificates as Prometheus metrics

Building

To build the Docker image, simply run docker build:

docker build . -t muxinc/certificate-expiry-monitor:latest

Running

Run the Docker image using the executable at /app:

→ docker run muxinc/certificate-expiry-monitor:latest /app --help
Usage of ./certificate-expiry-monitor:
  -domains string
        Comma-separated SNI domains to query
  -frequency duration
        Frequency at which the certificate expiry times are polled (default 1m0s)
  -hostIP
        If true, then connect to the host that the pod is running on rather than to the pod itself.
  -ignoredDomains string
        Comma-separated list of domains to exclude from the discovered set. This can be a regex if the string is wrapped in forward-slashes like /.*\.domain\.com$/ which would exclude all domain.com subdomains.
  -ingressNamespaces string
        If provided, a comma-separated list of namespaces that will be searched for ingresses with domains to automatically query
  -insecure
        If true, then the InsecureSkipVerify option will be used with the TLS connection, and the remote certificate and hostname will be trusted without verification (default true)
  -kubeconfig string
        Path to kubeconfig file if running outside the Kubernetes cluster
  -labels string
        Label selector that identifies pods to query
  -logformat string
        Log format (text or json) (default "text")
  -loglevel string
        Log-level threshold for logging messages (debug, info, warn, error, fatal, or panic) (default "error")
  -metricsPort int
        TCP port that the Prometheus metrics listener should use (default 8888)
  -namespaces string
        Comma-separated Kubernetes namespaces to query (default "default")
  -port int
        TCP port to connect to each pod on (default 443)

Kubernetes Manifest

You're probably going to want to run the certificate-expiry monitor in a Kubernetes cluster. The following manifest shows how you might monitor a set of ingress pods matching the label k8s-app=my-ingresses in the default namespace for the foobar.example.com domain:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: certificate-expiry-monitor
  namespace: default
spec:
  minReadySeconds: 5
  revisionHistoryLimit: 3
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
  template:
    metadata:
      labels:
        app: certificate-expiry-monitor
    spec:
      containers:
      - command:
        - /app
        - -labels
        - k8s-app=my-ingresses
        - -namespaces
        - default
        - -frequency
        - 1m
        - -domains
        - foobar.example.com
        image: muxinc/certificate-expiry-monitor:latest
        imagePullPolicy: Always
        livenessProbe:
          httpGet:
            path: /healthz
            port: 8888
          initialDelaySeconds: 5
          timeoutSeconds: 5
        name: certificate-expiry-monitor
        resources:
          limits:
            cpu: 20m
            memory: 50Mi
          requests:
            cpu: 20m
            memory: 50Mi

Monitoring

A Prometheus endpoint is available at /metrics on TCP port :8888 (customizable with metricsPort).

Labels

Name Description
ns Namespace of the pod that was queried
pod Pod being queried for TLS certificates
domain Domain being verified against TLS certificates
status Certificate is either valid, expired, soon (not yet valid), or notfound

Gauges

Name Labels Description
certificate_expiry_monitor_matching_pods ns Number of pods that match the label filter in a namespace
certificate_expiry_monitor_certificate ns, pod, domain, status Number of pods with a certificate in a given status for the domain
certificate_expiry_monitor_seconds_since_cert_issued ns, pod, domain Seconds since the certificate was issued
certificate_expiry_monitor_seconds_until_cert_expires ns, pod, domain Seconds until the certificate expires

Counters

Name Labels Description
certificate_expiry_monitor_tls_open_connection_error ns, pod, domain Number of times an error occurred while opening a TLS connection to a pod
certificate_expiry_monitor_tls_close_connection_error ns, pod, domain Number of times an error occurred while closing a TLS connection to a pod

Healthcheck

A simple healthcheck is available at /healthz on the TCP port :8888 (customizable with metricsPort):

→ curl -v http://localhost:8888/healthz
*   Trying ::1...
* TCP_NODELAY set
* Connection failed
* connect to ::1 port 8888 failed: Connection refused
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8888 (#0)
> GET /healthz HTTP/1.1
> Host: localhost:8888
> User-Agent: curl/7.52.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Mon, 04 Mar 2019 17:56:45 GMT
< Content-Length: 7
< Content-Type: text/plain; charset=utf-8
<
* Curl_http_done: called premature == 0
* Connection #0 to host localhost left intact
Healthy

More Repositories

1

media-chrome

Custom elements (web components) for making audio and video player controls that look great in your website or app.
TypeScript
1,215
star
2

next-video

The easiest way to add video in your Nextjs app.
TypeScript
757
star
3

stream.new

The repo for https://stream.new
TypeScript
499
star
4

upchunk

Uploads Chunks! Takes big files, splits them up, then uploads each one with care (and PUT requests).
TypeScript
335
star
5

meet

A meeting app built on Mux Real-Time Video.
TypeScript
278
star
6

elements

Custom elements for working with media in the browser that Just Work™
TypeScript
235
star
7

mux-node-sdk

Official Mux API wrapper for Node projects, supporting both Mux Data and Mux Video.
TypeScript
152
star
8

video-course-starter-kit

A starter template to help create a video course with Mux + Next.js
TypeScript
131
star
9

player.style

A fresh collection of media player themes for every use case!
HTML
125
star
10

examples

Example playground!
TypeScript
110
star
11

mux-go

Official Mux API wrapper for golang projects, supporting both Mux Data and Mux Video.
Go
89
star
12

webrtc-rebroadcaster

A "simple" webrtc rebroadcaster using FFmpeg
C++
88
star
13

mux-elixir

Official Mux API wrapper for Elixir projects, supporting both Mux Data and Mux Video.
Elixir
77
star
14

chromium_broadcast_demo

A simple demo showing how to use chromium as a WebRTC rendering engine
HTML
67
star
15

hlstools

Tools for analyzing and processing hls streams
C++
65
star
16

mux-ruby

Official Mux API wrapper for ruby projects, supporting both Mux Data and Mux Video.
Ruby
50
star
17

mux-python

Official Mux API wrapper for python projects, supporting both Mux Data and Mux Video.
Python
47
star
18

mux-stats-sdk-avplayer

Mux integration with `AVPlayer` for iOS Native Applications
Objective-C
43
star
19

mux-php

Official Mux API wrapper for PHP projects, supporting both Mux Data and Mux Video.
PHP
38
star
20

hls-video-element

A custom element (web component) for playing HTTP Live Streaming (HLS) videos.
JavaScript
38
star
21

youtube-video-element

A custom element (web component) for the YouTube player.
JavaScript
33
star
22

videojs-mux-kit

JavaScript
33
star
23

vmaf_analyzer

Estimates the average delivered VMAF for hls manifests
Go
32
star
24

example-ios-live-streaming

An example app for live streaming from an iOS device using the Mux live streaming service.
Swift
30
star
25

castable-video

Cast your video element to the big screen with ease!
JavaScript
25
star
26

strapi-plugin-mux-video-uploader

A Strapi plugin for managing uploads to Mux.
TypeScript
23
star
27

example-android-live-streaming

C++
23
star
28

videojs-super-resolution

Super Resolution for Video JS
JavaScript
21
star
29

truckload

Migrate your videos to any supported service
TypeScript
19
star
30

mux-stats-sdk-exoplayer

Monitors an ExoPlayer instance and reports player analytics to Mux Data
Java
19
star
31

mux-stats-sdk-react-native-video

JavaScript
17
star
32

stats-sdk-objc

Mux Stats SDK for iOS and tvOS
Objective-C
16
star
33

media-playlist

A custom element for playing through a set of audio and video elements.
JavaScript
15
star
34

bot-watcher

Example of using headless Chrome to test different aspects of a player
JavaScript
15
star
35

blurhash

Using woltapp/blurhash to make nice placeholders for Mux videos. Works nicely with Mux Player.
TypeScript
14
star
36

media-elements

A collection of HTMLMediaElement compatible elements and add-ons
JavaScript
13
star
37

cli

Command Mux from the command line like a boss.
TypeScript
11
star
38

media-group

👯‍♀️ mediagroup / MediaController which can be used to sync and control multiple audio / video elements
TypeScript
11
star
39

media-offset

✂️ Configures a media element to lock playback to a defined segment of the media
JavaScript
11
star
40

trivia.dev

IT'S TRIVIA! FOR DEVS! GO!
JavaScript
10
star
41

chromium_livestreamer

Take web pages and turn them into a live streams
Shell
8
star
42

custom-media-element

A custom element for extending the native media elements (<audio> or <video>)
JavaScript
8
star
43

chunked-transfer-demo

Webserver that demonstrates delivery of HLS media with HTTP chunked transfer encoding
Go
7
star
44

custom-video-element

A custom element for extending the native video element.
JavaScript
7
star
45

mux-csharp

C#
7
star
46

hls-subtitles-vexillographer

A simple proxy service which changes subtitles flags in HLS manifests.
Ruby
6
star
47

swift-upload-sdk

Mux's Video Upload SDK for iOS. The Swift equivalent of UpChunk.
Swift
6
star
48

shaka-video-element

A custom element (web component) for Shaka Player.
JavaScript
6
star
49

mux-player-swift

Use Mux Player Swift to stream and monitor video from Mux with AVKit and AVFoundation
Swift
6
star
50

android-upload-sdk

Mux's Video Upload SDK for Android. The Android equivalent of UpChunk.
Kotlin
5
star
51

chromecast-mux

JavaScript
5
star
52

roku-mux

Brightscript
5
star
53

mux-stats-sdk-media3

Mux Data SDK for AndroidX Media3
Kotlin
5
star
54

web-player-framework

JavaScript
5
star
55

mux-studio-demo

TypeScript
4
star
56

jamstack-conf-2020-workshop

JavaScript
4
star
57

next-video-site

TypeScript
4
star
58

mux-stats-google-ima

Swift
4
star
59

mux-protobuf

Mux Protobuf definition files
3
star
60

mux-android-distribution

A Gradle Plugin for distributing android builds, with support for Artifactory
Groovy
3
star
61

mux-player-android

Java
3
star
62

packaging_examples

Samples files packaged by mux
3
star
63

spaces-livekit-broadcast-layouts

TypeScript
3
star
64

mux-stats-sdk-theoplayer-ios

Mux Data Integration for THEOplayer's iOS SDK
Swift
2
star
65

meetup_colorspace_demo

HTML
2
star
66

mux-stats-sdk-theoplayer-android

Java
2
star
67

protogen

Protobuf Specification Generator written in Go
Go
2
star
68

media-tracks

Polyfill audio and video tracks with renditions.
TypeScript
2
star
69

video-archivist

A helpful Github bot that listens for links to videos in new issues, then asks maintainers if they want to archive it so it doesn't ever go away.
TypeScript
2
star
70

mux-java

Java
2
star
71

blurup

Generate a blurry image placeholder for a Mux video.
HTML
2
star
72

nextjs-backend-example

JavaScript
2
star
73

kaper

Kapacitor client written in Elixir.
Elixir
1
star
74

mux-stats-sdk-mediaplayer

Java
1
star
75

stackpath-urlauth

Golang library to sign Stackpath CDN URLs
Go
1
star
76

stats-sdk-exoplayer

Mux Stats SDK for ExoPlayer
Java
1
star
77

media-woofer

Kick up the bass on your media element!
JavaScript
1
star
78

webos-mux

LG WebOS
JavaScript
1
star
79

mux-docs

Docs for Mux SDKs and APIs
1
star
80

mux-delete-all-assets

Python
1
star
81

mipp

mipp - Pixel processing in JavaScript
C++
1
star
82

.github

Mux's shared templates and workflows.
1
star
83

stats-sdk-android

Core library for our Data SDKs for Android
Kotlin
1
star
84

tizen-mux

JavaScript
1
star
85

mux-stats-sdk-kaltura-android

A library for integration Mux Data with the Kaltura Playkit on Android
Java
1
star
86

blur-up-thumbs

HTML
1
star
87

simple-local-video-test-server

Uses a simple static server to host media files (with expected mimetype mappings).
HTML
1
star
88

templates

Repository of useful templates for use with Mux products
1
star
89

mux-stats-sdk-jwplayer-ios

Mux Data Integration for JWPlayer's iOS SDK
Objective-C
1
star