Skip to content

Instantly share code, notes, and snippets.

View jlcrow's full-sized avatar
:octocat:

Jason Crow jlcrow

:octocat:
View GitHub Profile
@mcastelino
mcastelino / prom_relabel.md
Created December 14, 2020 21:50
Kubernetes Pod Monitors & Re-Labeling

Kubernetes Pod Monitors & Re-Labeling

The Prometheus operator offers a simple method to scrape metrics from any Pod. However in many cases the Pod itself is not what you are monitoring but the Pod is used to expose metrics that relate to the Node. In such cases what the user cares about is the Node on which the Pod runs and not the Pod itself.

By default when using PodMonitor all the time series data will have the instance set to the Pod's name. Also the Pod or the Daemon set that the Pod was part of may be deleted, redeployed multiple times over the lifetime of the node. This means that the user will need to perform the mapping between the Pod and the Node on which it run.

However Prometheus allows the instance name (among other labels) to be relabeled in a very simple manner as shown below.

apiVersion: monitoring.coreos.com/v1
@hakdogan
hakdogan / gist:87e1a8eb782a41458a29
Created April 7, 2015 13:51
Illustrates the use of Elasticsearch Snapshot and Restore module with Java API.
package com.kodcu.es.util;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryResponse;
import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse;
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse;
import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotResponse;
import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest;
import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse;
// Restify Server CheatSheet.
// More about the API: http://mcavage.me/node-restify/#server-api
// Install restify with npm install restify
// 1.1. Creating a Server.
// http://mcavage.me/node-restify/#Creating-a-Server
var restify = require('restify');