Depending on the release of awk it could be:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
#!/usr/bin/gawk -f { if ( ($NF) in stats ) { stats[$NF] = stats[$NF]+1; } else { stats[$NF]=1; } } END { for ( var in stats) { print var " = " stats[var]; } } |
I saved the script as netstat_c.
I have to filter my netstat output to match only my tcp sockets prior to pipe the output to the script.
On linux:
1 2 3 4 |
$ netstat -a | grep ^tcp | netstat_c LISTEN = 13 ESTABLISHED = 74 TIME_WAIT = 7 |
This is great to check my webserver connections when I do stress tests.
The following two tabs change content below.
Latest posts by Ludovico (see all)
- New views in Oracle Data Guard 23c - January 3, 2024
- New in Data Guard 21c and 23c: Automatic preparation of the primary - December 22, 2023
- Does FLASHBACK QUERY work across incarnations or after a Data Guard failover? - December 13, 2023