Skip to content

Instantly share code, notes, and snippets.

View ajohnstone's full-sized avatar

Andrew Johnstone ajohnstone

View GitHub Profile
root@ip-10-239-75-244:~# FACTER_server_tags="role:hadoop-master=true,role:hadoop-worker=true" puppet apply --verbose -vvv --debug --modulepath /etc/puppet/modules /etc/puppet/manifests/site.pp
Debug: importing '/etc/puppet/modules/truth/manifests/enforcer.pp' in environment production
Debug: Automatically imported truth::enforcer from truth/enforcer into production
Error: Unknown function has_role at /etc/puppet/modules/truth/manifests/enforcer.pp:4 on node ip-10-239-75-244.eu-west-1.compute.internal
Error: Unknown function has_role at /etc/puppet/modules/truth/manifests/enforcer.pp:4 on node ip-10-239-75-244.eu-west-1.compute.internal
# Uncomment the next line to enable TCP/IP SYN cookies
net.ipv4.tcp_syncookies=0
# Uncomment the next two lines to enable Spoof protection (reverse-path filter)
# Turn on Source Address Verification in all interfaces to
# prevent some spoofing attacks
net.ipv4.conf.default.rp_filter=1
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
mkdir -p /opt/graphite/storage
mount -onoatime,nodiratime,nobarrier -t xfs /dev/xvdf /opt/graphite/storage
find /opt/graphite/storage/whisper/stats/collectd_bk -type f | while read file; do
dest=$(echo $file | sed 's/collectd_bk/collectd/g')
mkdir -p $(dirname $dest)
echo $dest;
rsync --recursive --perms --times --whole-file --ignore-existing $file $dest;
if [ -e "$file" ]; then
[cache]
# Configure carbon directories.
#
# OS environment variables can be used to tell carbon where graphite is
# installed, where to read configuration from and where to write data.
#
# GRAPHITE_ROOT - Root directory of the graphite installation.
# Defaults to ../
# GRAPHITE_CONF_DIR - Configuration directory (where this file lives).
# Defaults to $GRAPHITE_ROOT/conf/
Carbon relay - performance
alias(color(sumSeries(group(carbon.agents.*.updateOperations)), "blue"),"Updates")
alias(color(sumSeries(group(carbon.agents.*.metricsReceived)), "green"), "Metrics Received")
alias(color(sumSeries(group(carbon.agents.*.committedPoints)),"orange"),"Committed Points"))
alias(secondYAxis(color(sumSeries(group(carbon.agents.*.pointsPerUpdate)),"yellow")),"PPU")
alias(secondYAxis(color(averageSeries(group(carbon.agents.*.cpuUsage)),"red")),"CPU (avg)")
alias(secondYAxis(color(sumSeries(group(carbon.agents.*.creates)),"purple")),"Creates")
Metrics received
carbon.agents.*.metricsReceived
root 1475 33.5 0.5 467484 362016 ? Sl 14:55 122:38 /usr/bin/python /opt/graphite/bin/carbon-cache.py --config /opt/graphite/conf/carbon-cache.conf --instance=c start
root 1483 39.6 0.9 727544 636780 ? Sl 14:55 144:36 /usr/bin/python /opt/graphite/bin/carbon-cache.py --config /opt/graphite/conf/carbon-cache.conf --instance=b start
root 1491 25.5 28.2 19938972 19854664 ? Sl 14:55 93:12 /usr/bin/python /opt/graphite/bin/carbon-cache.py --config /opt/graphite/conf/carbon-cache.conf --instance=a start
LoadPlugin "apache"
<Plugin "apache">
<Instance "apache80">
URL "http://localhost/server-status?auto"
</Instance>
<Instance "apache81">
URL "http://localhost:81/server-status?auto"
</Instance>
</Plugin>
zcat Summary.2012-12-09.gz | grep '2012-12-09 20:[234]' | awk '
BEGIN{
size=50;
tmax = -999999999;
tmin = 999999999;
}
{ # Accumulate basic data
cnt[$10]++;
item[++n] = $10;
if ($10 > max) max = $10; if ($10 < min) min = $10;
{
"Records": [
{
"awsRegion": "eu-west-1",
"eventID": "0ed50878-9f42-4e73-a361-2d19ee0a61d7",
"eventName": "LookupEvents",
"eventSource": "cloudtrail.amazonaws.com",
"eventTime": "2015-11-22T12:26:22Z",
"eventType": "AwsApiCall",
"eventVersion": "1.04",
ELBS="`aws elb describe-load-balancers`";
echo "$ELBS" | jq -c '.LoadBalancerDescriptions[] | select(.LoadBalancerName|contains("production-services"))' | tr -d '^J' | while read line; do
NAME=$(echo $line | jq -r '.LoadBalancerName')
echo $NAME | grep tmp$ && continue;
LISTENERS=$(echo $line | jq -c '.ListenerDescriptions[].Listener'| tr -d '^J' | tr '\n' ',' | sed 's/^/\[/g;s/,$/]/g');
SCHEME=$(echo $line | jq -r '.Scheme')
aws elb create-load-balancer --load-balancer-name "${NAME}tmp" --listeners "${LISTENERS}" --scheme "${SCHEME}" --security-groups sg-3c7df658 --subnets subnet-f598ee9d
done;