Skip to content

Instantly share code, notes, and snippets.

View foxutech's full-sized avatar

FoxuTech foxutech

View GitHub Profile
@foxutech
foxutech / Argo CD Commands
Created June 19, 2022 11:48
This all some basic commands to check Argo CD Instance resources from CLI. Check our blog to know more about Argo CD https://foxutech.com/
To add the repo:
argocd repo add https://github.com/foxutech/kubernetes.git --username foxutech --password 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
To create a application:
# argocd app create kustom-check --repo https://github.com/foxutech/kubernetes.git --path kustomize/overlays/prod/ --dest-server https://kubernetes.default.svc --dest-namespace argocdtest
To Add the Cluster to ArgoCD
# argocd cluster add staging-azure
To check the list of Clusters
@foxutech
foxutech / monit-teams.sh
Last active September 13, 2022 15:26
How to enable monit alert to microsoft Teams, Check about monit with teams in https://foxutech.com monit part 2.
#!/bin/bash
# bash script to send messages to Microsoft Teams.
function usage {
echo "ALERT!"
echo "description: send messages to Microsoft Teams channels"
echo "special notes: You'll need to change the teamsUrl variable to contain your webhook from Teams."
echo "usage: ${0} -b \"Message contents\""
echo " -m Message body"
echo " -h This help info"
exit 1
@foxutech
foxutech / rdsdeletion.py
Created December 9, 2018 17:42
Automate RDS snapshot Deletion Using Lambda
import boto3
import datetime
def lambda_handler(event, context):
print("Connecting to RDS")
client = boto3.client('rds')
for snapshot in client.describe_db_snapshots(DBInstanceIdentifier='test-db-final', MaxRecords=5)['DBSnapshots']:
if create_ts < datetime.datetime.now - datetime.timedelta(days=3):
print ("Deleting snapshot id:", snapshot['DBSnapshotIdentifier'])
@foxutech
foxutech / ebsdeletion.py
Created December 9, 2018 17:20
Automate EBS snapshot Deletion Using Lambda
from datetime import datetime, timedelta, timezone
import boto3
class Ec2Instances(object):
def __init__(self, region):
print("region "+ region)
self.ec2 = boto3.client('ec2', region_name=region)
Step1: On management node, create the config file(if not exists)
# vim /var/lib/mysql-cluster/config.ini {{ replace IP with your node server hostname/IP }}
[[ copy the config.ini file in attachment ]]
We can now start the manager by executing the ndb_mgmd binary and specifying its config file using the -f flag:
# ndb_mgmd -f /var/lib/mysql-cluster/config.ini
Step2: enable executable permission to the script
@foxutech
foxutech / dnslookup.sh
Created October 8, 2018 12:04
dns lookup script with loop.. https://foxutech.com
#!/bin/bash
hostname=foxu.tech
sleep_time=2
count=0
success_count=0
max_count=$((1*6))
while [ $count -lt $max_count ];
do
@foxutech
foxutech / checking_ecs_cluster-taskandtaskdef_status.sh
Last active October 1, 2018 14:52
Script to check AWS ECS cluster Status.. https://foxutech.com
#!/bin/bash
set -e
CLUSTER=
FAMILY=
taskdef=$(aws ecs list-task-definitions --output text --query taskDefinitionArns[0])
for i in $taskdef; do
echo taskdef = $taskdef
if [ "$taskdef" == "None" ]; then
@foxutech
foxutech / awsecs-agent-monitor.sh
Last active September 24, 2018 17:24
Monitor AWS ECS Agent & restart agent automatically if any failure
#!/bin/bash
set -e
source /etc/ecs/ecs.config
CONTAINERS_ID=$(aws ecs list-container-instances --cluster $ECS_CLUSTER --output text --query 'containerInstanceArns')
echo $(CONTAINERS_ID)
INSTANCE_ID=$(curl http://169.254.169.254/latest/meta-data/instance-id)
echo $(INSTANCE_ID)
DATE=$(date +%Y-%m-%d-%H:%M)
read -p "enter aws-account-id: " aws-account-id
read -p "enter SNS topic: " topic
@foxutech
foxutech / xlstoxmlconvertor.py
Last active October 8, 2018 12:25
Excel to XML convertor.
import xlrd
from lxml import etree
import xml.etree.ElementTree as ET
# create the file structure
data = ET.Element('openSCENERIO')
wb = xlrd.open_workbook("sample.xlsx")
sh = wb.sheet_by_index(0)
conditiongroup = ""
condition = ""
apiVersion: v1
kind: ConfigMap
metadata:
name: logging-configmap
namespace: logging
data:
logstash.yml: |
http.host: "0.0.0.0"
path.config: /usr/share/logstash/pipeline
## Disable X-Pack