Skip to content

Instantly share code, notes, and snippets.

View signalfx.rabbitmq.collectd.types.db.custom
######################################################################################################
# SignalFX RabbitMQ (https://github.com/signalfx/collectd-rabbitmq)
# See https://docs.signalfx.com/en/latest/integrations/agent/monitors/collectd-rabbitmq.html
######################################################################################################
# ------------------------------------------
# Channel Counters (counter.channel)
# ------------------------------------------
counter.channel.message_stats.ack value:COUNTER:0:U # The number of acknowledged messages
counter.channel.message_stats.confirm value:COUNTER:0:U # Count of messages confirmed.
@jamesbjackson
jamesbjackson / View CollectD UDP packets
Last active Aug 13, 2021
View CollectD UDP packets
View View CollectD UDP packets
sudo tcpdump -i ens5 -n udp port 8125 -X
sudo tcpdump -i lo -n tcp port 2003 -X
@jamesbjackson
jamesbjackson / nginx_logging.conf
Last active Apr 14, 2021
Nginx Log JSON Formatting
View nginx_logging.conf
log_format main_json escape=json '{'
'"msec": "$msec", ' # request unixtime in seconds with a milliseconds resolution
'"connection": "$connection", ' # connection serial number
'"connection_requests": "$connection_requests", ' # number of requests made in connection
'"request_id": "$request_id", ' # the unique request id
'"request_length": "$request_length", ' # request length (including headers and body)
'"remote_addr": "$remote_addr", ' # client IP
'"remote_user": "$remote_user", ' # client HTTP username
'"remote_port": "$remote_port", ' # client port
'"date_gmt": "$date_gmt", ' # current time in GMT. The format is set by the config command with the timefmt parameter
@jamesbjackson
jamesbjackson / kubernetes_reading_list
Last active Nov 11, 2020
Reading list arround Kubernetes
View kubernetes_reading_list
Kubernetes Learning Resources
-----------------------------
50 days from zero to hero with Kubernetes (Free Video Content) by Microsoft
https://azure.microsoft.com/mediahandler/files/resourcefiles/kubernetes-learning-path/Kubernetes%20Learning%20Path_Version%202.0.pdf
@jamesbjackson
jamesbjackson / dump_route53_records.md
Last active Aug 14, 2020 — forked from porjo/dump_route53_records.md
Export route53 records to TSV & CSV
View dump_route53_records.md

Retrieve hosted zones with aws route53 list-hosted-zones then enter the zone Id below:

TSV

aws route53 list-resource-record-sets --hosted-zone-id "/hostedzone/xxxxxxxxxxx" | jq -r '.ResourceRecordSets[] | [.Name, .Type, (.ResourceRecords[]? | .Value), .AliasTarget.DNSName?]  | @tsv'

CSV

View Detected process using Cached RAM
# Find out what process is using all the RAM?
ps -e -o pid,vsz,comm= | sort -n -k 2
# clear page cache only without interrupting any processes or services. (Run as Root)
sync; echo 1 > /proc/sys/vm/drop_caches
# clear dentries and inodes only without interrupting any processes or services. (Run as Root)
sync; echo 2 > /proc/sys/vm/drop_caches
# clear page cache, dentries and inodes only without interrupting any processes or services. (Run as Root)
View Verify ERB Syntax
erb -x -T '-' file.erb | ruby -c
View how_to_catch_a_git_fork_to_master
git remote add upstream https://github.com/ORIGINAL_OWNER/REPOSITORY.git
git remote -v
origin https://github.com/USERNAME/REPOSITORY.git (fetch)
origin https://github.com/USERNAME/REPOSITORY.git (push)
upstream https://github.com/ORIGINAL_OWNER/REPOSITORY.git (fetch)
upstream https://github.com/ORIGINAL_OWNER/REPOSITORY.git (push)
git fetch upstream
git checkout master
git rebase upstream/master
View Checking MTU value for a port
nping -c 1 --tcp -p 80 10.10.10.1
Starting Nping 0.7.80 ( https://nmap.org/nping ) at 2020-01-29 16:53 GMT
SENT (0.0141s) TCP 192.168.1.221:5991 > 10.10.10.1:80 S ttl=64 id=35587 iplen=40 seq=1474941899 win=1480
RCVD (0.3046s) TCP 10.10.10.1:80 > 192.168.1.221:5991 SA ttl=37 id=0 iplen=44 seq=3029599029 win=11520 <mss 582>
Max rtt: 290.255ms | Min rtt: 290.255ms | Avg rtt: 290.255ms
Raw packets sent: 1 (40B) | Rcvd: 1 (46B) | Lost: 0 (0.00%)
Nping done: 1 IP address pinged in 1.02 seconds
@jamesbjackson
jamesbjackson / agent.nut
Created Jan 9, 2020 — forked from hfiennes/agent.nut
imp001 air quality monitoring (with AQI index)
View agent.nut
// Ensure we have a default reading
lastreading <- { "pm10":0, "pm25":0, "pm100":0 };
// Code to convert particlate density to AQI index
// based on https://gist.github.com/kfury/822bbba2cb0f946abb73baa156722ab1
function Linear(AQIhigh, AQIlow, Conchigh, Conclow, Conc) {
local a=((Conc-Conclow)/(Conchigh-Conclow))*(AQIhigh-AQIlow)+AQIlow;
return math.floor(a+0.5);
}