I wanted to understand where an app was spending time. I couldn’t get the granularity I needed from New Relic, and SSMS aggregated the data so I couldn’t see it. I came up with what is below, admittedly, somewhat obtuse,…
Category: Linux
Formatting netstat output
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…
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…
Finding client side port in Oracle
select machine||’:’||port from gv\$active_session_history where machine like ‘%app01%’ and inst_id = 1″ | sort -u ———————————————————— MACHINE||’:’||PORT hostname.domain:34218 MACHINE||’:’||PORT hostname.domain:34252 MACHINE||’:’||PORT hostname.domain:34312 MACHINE||’:’||PORT hostname.domain:34313 MACHINE||’:’||PORT hostname.domain:34314 MACHINE||’:’||PORT hostname.domain:34317 MACHINE||’:’||PORT hostname.domain:34319 MACHINE||’:’||PORT hostname.domain:34326 MACHINE||’:’||PORT hostname.domain:34328 MACHINE||’:’||PORT hostname.domain:34331 MACHINE||’:’||PORT hostname.domain:34332 MACHINE||’:’||PORT hostname.domain:34334…
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 } }…
Using strace to determine progress when processing a file
I thought this was interesting, as I stumbled upon it. I find the most useful things often result from stumbling 😉 I had a job running that was gunzip’ing a file and piping the output to a python script. The…
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…
Tying a linux socket file descriptor to a port and IP
While troubleshooting a java thread that appeared to be hung, but not blocked, we used the following troubleshooting process. You can use what is below if you have a thread “stuck” waiting to receive data from another socket. We see…