Skip to content

Instantly share code, notes, and snippets.

View tanmay-bhat's full-sized avatar

Tanmay Bhat tanmay-bhat

View GitHub Profile
server:
log_level: info
http_listen_port: 12345
metrics:
global:
scrape_interval: 30s
external_labels:
environment: test-server
configs:
@tanmay-bhat
tanmay-bhat / docker-compose file grafana agent
Created February 27, 2022 07:11
docker-compose file which collects container & node metrics via grafana agent and sends to prometheus server via remote write
version: "3"
services:
grafana-agent:
image: grafana/agent:v0.23.0
container_name: grafana-agent
volumes:
- /path/to/data/:/etc/agent/data
- /path/to/agent.yaml:/etc/agent/agent.yaml
@tanmay-bhat
tanmay-bhat / argocd imager updater application config
Created February 27, 2022 08:15
argocd imager updater application config for kube-ops-view demo application
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: kube-ops-view-demo
finalizers:
- resources-finalizer.argocd.argoproj.io
namespace: argocd
annotations:
argocd-image-updater.argoproj.io/image-list: registry.digitalocean.com/tanmaybhat/kube-ops-view
argocd-image-updater.argoproj.io/write-back-method: git:secret:argocd/gitlab-token
> docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
registry.digitalocean.com/tanmaybhat/kube-ops-view latest a645de6a07a3 21 months ago 253MB
registry.digitalocean.com/tanmaybhat/kube-ops-view v1.2.3 a645de6a07a3 21 months ago 253MB
> docker tag registry.digitalocean.com/tanmaybhat/kube-ops-view:latest registry.digitalocean.com/tanmaybhat/kube-ops-view:v1.2.4
> docker images
@tanmay-bhat
tanmay-bhat / docker-compose.yaml
Created March 26, 2022 11:09
Simple Docker compose file to start Prometheus server along with node-exporter
version: '3.8'
services:
node-exporter:
image: prom/node-exporter:latest
container_name: node-exporter
restart: unless-stopped
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
@tanmay-bhat
tanmay-bhat / config.yml
Last active March 31, 2022 09:36
Configure Readiness Probe alert in Prometheus for Kubernetes
### ALert Configuration
- alert: KubePodReadinessFailure
annotations:
description: Readiness probe for the Pod {{ $labels.pod }} is failing for last 10 minutes
expr: sum by(pod)( kube_pod_info{created_by_kind!="Job"} AND ON (pod, namespace) kube_pod_status_ready{condition="false"} == 1) > 0
for: 10m
labels:
severity: warning
@tanmay-bhat
tanmay-bhat / promql.md
Created April 5, 2022 11:58
PromQL expression to exclude multiple labels

Sample scenario :

How to exclude a specific mount-point value of a specific host in a metric node_filesystem_free_bytes ?

node_filesystem_free_bytes{} unless node_filesystem_free_bytes{instance="10.10.0.1",mountpoint="/dir"}

The above query will show available bytes of all hosts & mountpoints except mountpoint /dir on 10.10.0.1


Stackoverflow answer : Link

@tanmay-bhat
tanmay-bhat / values.yml
Last active April 12, 2022 18:17
Sample Prometheus values yaml file
rbac:
create: false
podSecurityPolicy:
enabled: false
imagePullSecrets:
# - name: "image-pull-secret"
## Define serviceAccount names for components. Defaults to component's fully qualified name.
@tanmay-bhat
tanmay-bhat / ssh-config.sh
Last active August 29, 2022 23:26
Shell script to automate configuration of ssh to all servers in KodeKloud Engineer.
#!/bin/bash
set -eu
if ! command -v ssh-keygen &> /dev/null ;then
echo "Cant seem to find 'ssh-keygen' binary, are you sure its installed ?"
exit 1
fi
if ! command -v ssh &> /dev/null ;then
echo "Cant seem to find 'ssh' binary, are you sure its installed ?"
@tanmay-bhat
tanmay-bhat / load-kibana-dashboard-metricbeat.md
Created May 18, 2022 06:05
How to load Kibana dashboards from metricbeat pod in kubernetes
  1. Exec into any of the metric beat pod ( part of daemon set ) :
kubectl exec -it <metricbeat-pod-name> bash -n <namespace>
  1. Run the below command :
./metricbeat setup --dashboards -E setup.kibana.host=kibana-kibana:5601