Influxdbv2
# Local Linux install
# Export measurement to line protocol
$ sudo influxd inspect export-lp --bucket-id <id> --engine-path /var/lib/influxdb/engine/ --measurement <name> --output-path <path-to-file>
# import measurement from line protocol
$ sudo influx write --org <org> -b <bucket> -f <path-to-file> --token $INFLUX_TOKEN
# delete measurements
$ sudo influx delete --org <org> --bucket <bucket> --start '1970-01-01T00:00:00Z' --stop $(date +"%Y-%m-%dT%H:%M:%SZ") --predicate '_measurement="<name>"' --token $INFLUX_TOKEN
# run v1 client
$ influx v1 shell
# backup
$ influx backup <target dir> -t $INFLUX_TOKEN
# list retention policies
$ influx v1 dbrp list
# create default retention policy
$ influx v1 dbrp create --db <db> --rp autogen --bucket-id <bucketid> --token $INFLUX_TOKEN
WebRquest
Web page timings from Windows Powershell: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-webrequest
Powershell version
PS > $PSVersionTable
Show current user certificate thumbprints
PS > get-ChildItem Cert:\CurrentUser\My
Set Tls version
PS > [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Measure page download time
PS > Measure-Command {Invoke-WebRequest -Uri "https://<>" -CertificateThumbprint ""}
Curl
Example curl request below prints out details about the timing and size of the request. Further details and options can be found on the man page for curl here: https://curl.se/docs/manpage.html
$ curl -s -o /dev/null --cert <pem> --key <pem> --insecure -k "url" -w "URL=%{url_effective} RTT=%{time_total} SIZE=%{size_download} TTFB=%{time_starttransfer} CODE=%{http_code} DNS=%{time_namelookup} CONNECT=%{time_connect} appconnect=%{time_appconnect}\n"
chrome://net-internals
A number of useful tools, but very useful for debugging and tracing socket streams used by chrome. Further details can be found here: https://chromium.googlesource.com/chromium/src/+/HEAD/net/docs/crash-course-in-net-internals.md
NMON
Linux monitoring with Excel macro for creating a spreadsheet or nmonchart for creating an html report. For more information see here: https://nmon.sourceforge.io/pmwiki.php
Git
# clone a repository
git clone <repository>
# checkout and track remote branch
git branch -a
# git checkout -b <feature-name> origin/<feature-name>
git status
git add .
git commit -m "commit message"
git push
# If feature branch is behind remote main, update local main and use rebase to preserve history.
git checkout main
git pull
git checkout <feature-name>
git rebase main
# If there are merge conflicts on added/removed files correct this using
git add/rm <filename>
# If there are merge conflicts on changed files, edit the file and remove the unwanted changes and conflict markers. Then add the updated file
git add <filename>
git rebase --continue
# Edit local git config on linux
git config --global --edit
Redis
keys *
type <key>
lrange <key> <start> <end>
del key
dbsize
info
type <key>
delete all keys from a redis instance:
redis-cli keys "*" | xargs -I {} redis-cli del {}
Java
# Print command line flags available for the JVM (https://docs.oracle.com/javase/8/docs/technotes/tools/unix/java.html)
java -XX:+PrintFlagsFinal
# Print ergonomically selected flags for the JVM that appeared on the command line
java -XX:+PrintCommandLineFlags
# Java17 - show the cgroup version, cpu and memory limits.
java -XshowSettings:system
Jcmd
# Print options
jcmd <pid>
# Get flags that can be set using jcmd
jcmd <pid> VM.flags -all | grep manageable
# Set flag
jcmd <pid> VM.set_flag <flag> <value>
Jmap
# create heap dump of all objects in binary format
jmap -dump:format=b,file=/tmp/dump.hprof <pid>
Java Flight Recorder
Java flight recorder can be used for profiling a JVM with claimed low overhead. This is particularly useful as it can be used for looking at an already running JVM without having to enable command line options for the running application. JFR can provide useful information on e.g. heap use and object counts, GC activity and pause time, socket i/o, thread locking. For further information please see documentation here: https://docs.oracle.com/javacomponents/jmc-5-4/jfr-runtime-guide/about.htm#JFRUH170.
# Example commands to start JFR using jcmd are shown below.
jcmd <pid> JFR.start duration=60s
jcmd JFR.check
# Unless a filename is specified the default directory data is written to is /tmp.
# By default jfr will chunk up a recording in to separate files. To re-combine these into a single # file for analysis run:
jfr assemble <directory> output-file-name.jfr
Keytool
# create a jks from pfx
# e.g. from chrome export certificate with all certificates in the chain and include private key
keytool.exe -importkeystore -srckeystore "<name.pfx" -srcstoretype pkcs12 -destkeystore "<name>.jks"
cAdvisor
Container resource monitoring tool. This is very useful as can be run as a standalone binary with an HTTP UI with minimal install. https://github.com/google/cadvisor
Top
# display cpu by thread for a process
top -H -p <pid>
# sample processes every second, for 30 seconds and output to a file
top -d 1 -n 30 -b > top-output-processes.txt
# sample threads for a processes every 100ms, for 30 seconds and output to a file
top -H -p <pid> -d 0.1 -n 300 -b > top-output-threads-100ms.txt
# get the average running thread count for a process in a thread sample (e.g. above)
grep Threads top-output-threads-100ms.txt | tail -299 | tr -s ' ' | cut -d' ' -f4 | awk '{total += $1; n++}END{print total, total/n}'
ctr
A debug and administrative client for interacting with the containerd daemon
$ for i in ctr --namespace k8s.io.containers ls | grep <name> | cut -d' ' -f1;
do
ctr --namespace k8s.io task ist | grep $i;
done
e.g. a087b8b5e433f80114dc5104f818d1a183af48bdb23774f0e28f9ee4b43ab5ae 4976 RUNNING
Load Average
/proc/loadavg
0.29 0.17 0.15 1/586 249213
MongoDB
show dbs
use <db>
db.getCollectionNames()
db.<collection>.getIndexes()
RabbitMQ
rabbitmq-diagnostics status
rabbitmqctl list_queues