This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Requirement: performance_schema = ON | |
SELECT | |
lw.waiting_pid, | |
lw.waiting_query, | |
lw.waiting_trx_age AS 'waiting_time', | |
lw.blocking_pid, | |
( | |
SELECT h.SQL_TEXT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
import argparse | |
class main: | |
def __init__(self): | |
# Grab parameters | |
parser = argparse.ArgumentParser() | |
parser.add_argument('--region', required=True, help='AWS region name (eu-west-1)') | |
parser.add_argument('--instance', required=True, help='Database instance name') | |
parser.add_argument('--profile', required=False, help='AWS profile name ($ aws configure --profile customer)') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import boto3 | |
import numpy as np | |
import argparse | |
import threading | |
from datetime import datetime, timedelta, timezone | |
class main: | |
def __init__(self): | |
# Grab parameters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
account="123456789" | |
echo "Account, Region, SnapshotCreateTime, DBSnapshotIdentifier, DBInstanceIdentifier, Engine, AllocatedStorage" > "$account.csv" | |
for region in $(aws ec2 describe-regions --profile customer --query "Regions[].RegionName" --output text); do | |
echo "Region: $region" | |
snapshots=$(aws rds describe-db-snapshots --profile customer --region $region --query "DBSnapshots[?SnapshotType=='manual'].[SnapshotCreateTime, DBSnapshotIdentifier, DBInstanceIdentifier, Engine, AllocatedStorage]" --output json) | |
if [ -n "$snapshots" ]; then | |
echo "$snapshots" | jq -r --arg account "$account" --arg region "$region" '.[] | "\"\($account)\",\"\($region)\"," + @csv' >> "$account.csv" | |
fi | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install dependencies: python3 -m pip install boto3 numpy rich | |
import json | |
import boto3 | |
import argparse | |
import numpy as np | |
from decimal import Decimal | |
from datetime import datetime, timedelta | |
from rich.console import Console | |
from rich.table import Table |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install dependencies: python3 -m pip install boto3 rich | |
import json | |
import boto3 | |
import argparse | |
from decimal import Decimal | |
from datetime import datetime, timedelta, timezone | |
from rich.console import Console | |
from rich.table import Table | |
from rich.tree import Tree |