We had a need to ingest open sockets into Splunk so we could map our integration points across the enterprise. We came up with what is below. This will show if the host on which it is run is a…
Category: Shell scripting
awk statistical functions
We had already written an awk script to pull durations for a particularly slow web service call. We wanted to understand the distribution of the response times. Often, the average is high, but it is skewed by a number of…
awk date math
Just a reference post for how to determine the number of seconds between two date strings in awk. If you have a normally formatted date string in Linux, such as “Sun Mar 19 00:50:33 EDT 2017”, you can convert this…
Does a command retain open file handles when the output of the pipe is aggregated?
We had 90,000 open awk file handles owned by a single shell process, and didn’t know if a command such as what is below would result in each file handle being retained even after its output was processed and the…
Simple awk script to print blocked threads
Yet another variation on this theme. This is good because it will allow you to quickly go to the problem thread. #!/bin/awk -f { if ($0 ~ “- locked” || $0 ~ “- waiting to lock”) { s[i++]=$0 } }…
Gathering information from HotSpot garbage collection logs
What is below is a useful script to print actionable information from garbage collection logs. As shown by the CMS output below, this is built for the CMS collector. Anything with initial-mark or remark in the output is a “stop…