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
- 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
@frgaudet
frgaudet / install_puppet_agent.sh
Last active December 4, 2020 15:13
Install puppet agent on a running computer/VM
SERVER=foreman
cat > /etc/apt/sources.list.d/puppetlabs.list << EOF
deb http://apt.puppetlabs.com trusty main
deb-src http://apt.puppetlabs.com trusty main
deb http://apt.puppetlabs.com trusty dependencies
deb-src http://apt.puppetlabs.com trusty main dependencies
EOF
apt-get update