Skip to content

Instantly share code, notes, and snippets.

View frgaudet's full-sized avatar
🏠
Working from home

Frédéric Gaudet frgaudet

🏠
Working from home
View GitHub Profile
apiVersion: v1
kind: Namespace
metadata:
name: external
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: tinyproxy
namespace: external
- expr: |
(((1-sli:ratio_failure_rate1m{stack="my-app",type="availability"}) > bool (1-0.001000))
record slo:__flag
- expr: sum by(job) (rate(istio_requests_total{destination_app="my-app",response_code=~"5.*"}[1m]))
/ sum by(job) (rate(istio_requests_total{destination_app="my-app"}[1m]))
labels:
stack: my-app
type: availability
record: sli:ratio_failure_rate1m
@frgaudet
frgaudet / main.go
Created September 10, 2020 14:20 — forked from zupzup/main.go
ElasticSearch to Prometheus Exporter in Go
package main
import (
"context"
"github.com/go-chi/chi"
"github.com/go-chi/render"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
log "github.com/sirupsen/logrus"
"gopkg.in/olivere/elastic.v6"
#!/usr/bin/env python
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#!/bin/bash
# coding=utf-8
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
#!/usr/bin/env python
# coding=utf-8
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
#!/usr/bin/env python
# coding=utf-8
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
#!/usr/bin/env python
# coding=utf-8
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@frgaudet
frgaudet / apply_hostname
Created May 25, 2015 06:48
Apply hostname from DNS
#!/bin/sh
# Apply hostname from DNS server
# Author : F-Gaudet 2014
# Usage : drop this file into /etc/NetworkManager/dispatcher.d
interface=$1 status=$2
if [ $status = up ]; then
ip=$(ip addr | grep $interface: -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/' )
string=$(host $ip) > /dev/null