Skip to content

Instantly share code, notes, and snippets.

bakins / escape_test.go
Created Apr 2, 2019
compare escapeMetricName
View escape_test.go
package main
import (
var illegalCharsRE = regexp.MustCompile(`[^a-zA-Z0-9_]`)
func regexVersion(metricName string) string {
bakins / x.diff
Created Apr 2, 2019
stastd_exporter speed up
View x.diff
diff --git a/exporter.go b/exporter.go
index 15c01b7..c225fcf 100644
--- a/exporter.go
+++ b/exporter.go
@@ -21,7 +21,6 @@ import (
- "regexp"
bakins / alecton.proto
Last active Aug 17, 2017
Deployment API backed by helm charts and tiller
View alecton.proto
// API for a deployment service.
// It's easier for me to express an API as protobuf/service
// definitions. grpc-gateway would be used, so HTTP/1.1 and
// json would work. A simple browser API could be provided.
// This API is meant for users - both systems and humans -
// to easily deploy images.
// The envisioned flow is that the build system would push
// images to a registry and notify this service using CreateImage.
// Another step in the pipeline would then use DeployApplication
bakins / gist:5bf7d4e719f36c1c555d81134d8887eb
Last active Dec 1, 2020
prometheus - scrape multiple containers in a pod
View gist:5bf7d4e719f36c1c555d81134d8887eb
# Example scrape config for pods
# The relabeling allows the actual pod scrape endpoint to be configured via the
# following annotations:
# * ``: Only scrape pods that have a value of `true`
# * ``: If the metrics path is not `/metrics` override this. This
# will be the same for every container in the pod that is scraped.
# * this will scrape every container in a pod with `` set to true and the
port is name `metrics` in the container
# get our hostip if running under kubernetes
if [[ -n "${KUBERNETES_NAMESPACE}" && -n "${KUBERNETES_PODNAME}" ]] ; then
while true; do
KUBERNETES_HOSTIP=`kubectl get pods --namespace=${KUBERNETES_NAMESPACE} ${KUBERNETES_PODNAME} -o json | jq -r .status.hostIP`
if [ -n "${KUBERNETES_HOSTIP}" ] && [ "${KUBERNETES_HOSTIP}" != "null" ]; then
sleep 1
bakins / datadog.diff
Created Dec 9, 2015
datadog 5.6.2 patch
View datadog.diff
diff --git a/utils/ b/utils/
index 975b260..d8e0868 100644
--- a/utils/
+++ b/utils/
@@ -82,6 +82,7 @@ def find_cgroup_filename_pattern(mountpoints, container_id):
stat_file_path_coreos = os.path.join(mountpoint, "system.slice")
stat_file_path_kubernetes = os.path.join(mountpoint, container_id)
stat_file_path_kubernetes_docker = os.path.join(mountpoint, "system", "docker", container_id)
+ stat_file_path_docker_daemon = os.path.join(mountpoint, "docker-daemon", "docker", container_id)
View kubernetes cert generation
set -e
set -x
# create certs for a kubernetes cluster
usage() {
echo $0 [cluster_name] [service_ip] [additional_names]
echo additional name is generally the dns name
exit -1
View kube-proxy.json
set -e
WORKDIR=$(mktemp -d k8s.XXXXXXXXXX)
trap "rm -rf '${WORKDIR}'" EXIT
View gist:18ea6d23f72ecda03d96
cat terraform.tfstate | jq -r '.modules[0].resources | map(select(.type == "google_compute_instance")) | map([, " ansible_ssh_host=", .primary.attributes["network_interface.0.access_config.0.nat_ip"]] | join("")) | sort | .[]'
cd /tmp
curl -L -O
tar -zxvf rkt-v0.5.4.tar.gz
cd rkt-v0.5.4
echo yes | ./rkt trust --prefix
./rkt fetch
You can’t perform that action at this time.