Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Hai Dam.V naviat

🏠
Working from home
View GitHub Profile
@naviat
naviat / slowquery_logger.sh
Created Nov 30, 2022 — forked from theprogrammerin/slowquery_logger.sh
Bash script to fetch the log for that hour from Amazon RDS and push it to ElasticSearch / Kibana
View slowquery_logger.sh
#!/bin/bash
#
# Ashutosh Agrawal
# http://blog.theprogrammer.in
#
#
# This bash script simply fetches the log for that hour from Amazon RDS,
# parse and genarlise it using mysql_slow_log_parser (https://gist.github.com/theprogrammerin/e3206a4ec7a7a4086ac2)
# and then push the parsed log to elastic search using logstash (slowquery.conf)(https://gist.github.com/theprogrammerin/034a3efd849112d166ea)
# For analysis on analytic tool like kibana.
@naviat
naviat / simple-k8s-backup.sh
Created Nov 8, 2022 — forked from mweibel/simple-k8s-backup.sh
Simple k8s backup if you don't yet have k8up or velero in place. Use with caution. Extend extracted values as needed.
View simple-k8s-backup.sh
#!/bin/bash
set -o pipefail -o errexit -o nounset -o errtrace
mkdir -p backup/
for ns in $(kubectl get ns --no-headers -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}'); do
kubectl --namespace="${ns}" get -o=yaml role,rolebinding,secret,configmap | \
yq eval '
del(
@naviat
naviat / mapping.yaml
Created Oct 6, 2022 — forked from mweibel/mapping.yaml
banzaicloud/logging-operator working ElasticSearch example with index lifecycle management
View mapping.yaml
apiVersion: v1
kind: Secret
metadata:
name: index-template
stringData:
template: '{"index_patterns":["logstash-*"],"template":{"aliases":{"logstash":{}},"mappings":{"dynamic":"true","dynamic_date_formats":["strict_date_optional_time","yyyy/MM/dd HH:mm:ss Z||yyyy/MM/dd Z"],"dynamic_templates":[]},"settings":{"index":{"lifecycle":{"name":"logstash_policy","rollover_alias":"logstash"},"number_of_shards":"1","number_of_replicas":"0"}}}}'
@naviat
naviat / gist:7cf3f136f8e96b5de0961a95e6ebc38c
Created Jul 21, 2022 — forked from exAspArk/gist:c325bb9a75dcda5c8212
Elasticsearch: calculating user sessions with Map/Reduce (Ruby)
View gist:7cf3f136f8e96b5de0961a95e6ebc38c
# The same algorithm which is used in Google Analytics (https://support.google.com/analytics/answer/2731565?hl=en):
# Time-based expiry (including end of day):
# - After 30 minutes of inactivity
# - At midnight
# Enable dynamic scripting for Groovy (https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html#_enabling_dynamic_scripting)
# ! WARNING: please read about security first
# Usage:
#
@naviat
naviat / Dockerfile
Created May 27, 2022 — forked from angeloskaltsikis/Dockerfile
A wrapper to make Terragrunt less verbose (both plan & apply supported). Also includes all the files required to efficiently run Terragrunt with Atlantis.
View Dockerfile
ARG atlantis_version=v0.15.0
FROM runatlantis/atlantis:${atlantis_version}
LABEL maintainer="Beat DevOps Team"
LABEL description="thebeat.co atlantis image used in IaC CI/CD!"
LABEL version="0.2"
# https://github.com/gruntwork-io/terragrunt/releases
ARG terragrunt_version=v0.25.1
@naviat
naviat / monzo-alertmanager-config.yaml
Created Apr 25, 2022 — forked from milesbxf/monzo-alertmanager-config.yaml
Monzo's Alertmanager Slack templates
View monzo-alertmanager-config.yaml
###################################################
##
## Alertmanager YAML configuration for routing.
##
## Will route alerts with a code_owner label to the slack-code-owners receiver
## configured above, but will continue processing them to send to both a
## central Slack channel (slack-monitoring) and PagerDuty receivers
## (pd-warning and pd-critical)
##
@naviat
naviat / values.yaml
Created Apr 15, 2022 — forked from l13t/values.yaml
alertmanager alerts to slack for prometheus-operator
View values.yaml
.......some config.....
alertmanager:
## Deploy alertmanager
##
enabled: true
## Service account for Alertmanager to use.
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
##
View Vagrant + Multi-Node MicroK8S - README.md

Using Vagrant with Multi-Node MicroK8S to experiment with Kubernetes

This script (using Vagrant) is used to build a pair of Ubuntu based virtual machines that have the MicroK8S setup of Kubernetes.

It also installs docker, and sets up aliases for kubectl in line with the MicroK8S documentation.

Please note that this script relies on the fact that Vagrant transfers files in /vagrant to the host file system, which we can then use to setup the second node.

@naviat
naviat / Vagrant + MicroK8S - README.md
Created Apr 12, 2022 — forked from JonTheNiceGuy/Vagrant + MicroK8S - README.md
Using Vagrant with MicroK8S to experiment with Kubernetes
View Vagrant + MicroK8S - README.md
@naviat
naviat / redis_migrate.py
Created Mar 25, 2022 — forked from josegonzalez/redis_migrate.py
A simple script to migrate all keys from one Redis to another
View redis_migrate.py
#!/usr/bin/env python
import argparse
import redis
def connect_redis(conn_dict):
conn = redis.StrictRedis(host=conn_dict['host'],
port=conn_dict['port'],
db=conn_dict['db'])
return conn