This file contains hidden or 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
Syntax: Enfo_iam.sh | |
Options: | |
-c|--cache-dir <dir> Use a specifc report cache dir. Default is /var/cache/Enfo_iam/Enfo_iam_report_*. | |
-d|--debug Debug output | |
-E|--exit-on-error Stop script on aws error | |
-e|--error Error output | |
-f|--fresh-data Get a new report, automatically saved as last cache when finished | |
Works well with -q for cronjobs or with '-q -d' for debug | |
-F|--fields <comma separated fileds list> | |
Comma separated columns list (see below) |
This file contains hidden or 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
#!/bin/bash | |
# Syntax: ec2_kamino.sh <source instance 'Name' tag> [target new instance 'Name' tag]. | |
# If target name is not given <source name>-clone is used. | |
# Description: Builds a temporary template from a given instance and runs the latest found ami from that template. | |
# New instance settings can be overriden by $overrides. | |
# AMI selection is filtered by $ami_select. | |
# New instance in also tagged with 'clone-source' tag of source instance. | |
# New instance EBS volumes are tagged with the same 'Name' tag of the new instance. | |
# Written by Shoko, Oct2019. | |
# Requires: jq, awscli, standard gnu utils. |
This file contains hidden or 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
#!/bin/bash | |
. /opt/EC2ulz/EC2ulz.sh | |
#max_age=660 | |
max_age=720 | |
balance_warn=50 | |
balance_crit=20 | |
# history of metrics to get in minutes | |
metric_time=15 | |
# Couldn't find an API for this data so it's hard coded :( |
This file contains hidden or 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
mklive_cmd='/usr/bin/naemon-unixcat /omd/sites/magisto/tmp/run/live'; while true; do O=$((echo "Host,Check,Status,Interval,Delay,Exec"; echo -e 'GET services\nColumns: host_name description last_state check_interval last_check execution_time' | $mklive_cmd | awk -F';' -v N=`date +%s` 'N-$5 > $4*60 {printf "%s,%s,%d,%d,%d,%.2f\n", $1, $2, $3, $4*60, N-$5, $6}') | column -s , -t); clear; date; echo; uptime; echo; free -m; echo; echo "$O"; echo " Count:`echo \"$O\" | wc -l`"; sleep 10; done |
This file contains hidden or 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
#!/bin/bash | |
# Syntax: csv_header.sh "<space delimited head names>" "<empty string replacment>" | |
awk -F, -v E="${2:--}" -v H="$1" -v D="^^^" ' | |
NR==1 { | |
split(H,h," ") | |
for (i=1; i<=NF; i++) { | |
f[$i] = i | |
} | |
for (i in h) { | |
printf "%s%s", h[i], D |
This file contains hidden or 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
#!/bin/bash | |
region="--region us-east-1" | |
profile="" | |
elb_name="" | |
alb=false | |
while [[ $# > 0 ]]; do | |
key="$1" | |
case $key in | |
--elb) elb_name="${2/*lb./}";; |
This file contains hidden or 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
#!/bin/bash | |
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | |
netcat=$(which nc) | |
host='<carbon IP>' | |
port='2003' | |
nc_cmd="$netcat -q0 $host $port" | |
get_month(){ | |
f="<your id>-aws-billing-detailed-line-items-with-resources-and-tags-${1}" |
This file contains hidden or 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
#!/bin/bash | |
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | |
netcat=$(which nc) | |
host='<carbon IP>' | |
port='2003' | |
nc_cmd="$netcat -q0 $host $port" | |
get_month(){ | |
f="<your id>-aws-billing-detailed-line-items-with-resources-and-tags-${1}" |
This file contains hidden or 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
#!/bin/bash | |
ssh_ops='-fn -o ConnectTimeout=1 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR' | |
print_help(){ | |
echo "Syntax: $0 <instance grep string> <log file> [grep regex] | |
example: mtail.sh 'proc-app-fronts?|proc-app-back001' /var/log/apache2/access.log '404|500' | |
exit mtail with Ctrl-C" | |
} | |
[ $# -lt 2 ] && print_help && exit |
This file contains hidden or 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
#!/bin/bash | |
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/snap/bin | |
log="/var/log/aws_inspector/aws_inspector_export_rep.log" | |
template_arn='arn:aws:inspector:us-east-1:XXXXXXXXXXXX:target/xxxxxxxxxx/template/xxxxxxxxxx' | |
wait_sec='5400' | |
log_out(){ | |
(($verifymon)) &&\ | |
echo -e "`date +'%Y-%m-%d %H:%M:%S'` (pid $$) -- $1" >> $log ||\ | |
echo -e "`date +'%Y-%m-%d %H:%M:%S'` (pid $$) -- $1" | tee -a $log |
NewerOlder