diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2018-04-16 10:30:15 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2018-04-16 10:30:15 +0200 |
commit | 55783753ae8f2d857a7225b7a93c1d47039e5a90 (patch) | |
tree | e077b61b0f004141712e7d16876f9c19175ac681 /scripts/netstat-in.sh | |
download | conky-55783753ae8f2d857a7225b7a93c1d47039e5a90.tar.gz conky-55783753ae8f2d857a7225b7a93c1d47039e5a90.tar.bz2 conky-55783753ae8f2d857a7225b7a93c1d47039e5a90.tar.xz conky-55783753ae8f2d857a7225b7a93c1d47039e5a90.zip |
OpenShift monitoring
Diffstat (limited to 'scripts/netstat-in.sh')
-rwxr-xr-x | scripts/netstat-in.sh | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/scripts/netstat-in.sh b/scripts/netstat-in.sh new file mode 100755 index 0000000..993d97e --- /dev/null +++ b/scripts/netstat-in.sh @@ -0,0 +1,9 @@ +#! /bin/bash + +query="" +for port in `netstat -lntu | tail -n +3 | grep -v "127.0.0.1" | awk -e '{print $4}' | rev | cut -d ':' -f 1 | rev | sort -n | uniq`; do + [ $port -gt 32768 ] && continue; + [ -z "$query" ] && query="sport = :$port" || query="$query or sport = :$port" +done + +eval /sbin/ss -nrtu state established "'( $query ) '" | tail -n +2 | grep -v localhost | awk -F'[:\t ]+' -e '$6 != $4 { print $6, $5 }' |