Mobile app version of vmapp.org
Login or Join
Heady270

: Here is a small script that I use. I have an SSL based site, so I'm checking the active connections on port 443. You might want to update 443 to 80, depending on what you would like

@Heady270

Here is a small script that I use. I have an SSL based site, so I'm checking the active connections on port 443. You might want to update 443 to 80, depending on what you would like to monitor.

#!/bin/bash

[ $# -eq 0 ] && { echo "Usage: [CO] <refresh time>" ; exit 1; }

while true
do
clear;
echo "Number of Active Connections:";
netstat -an | grep 443 | grep tcp | grep -v 0.0.0.0 | grep -v ::: | cut -d':' -f2 | cut -d' ' -f12 | sort | uniq | wc -l;
echo;
echo "Current Active IP's:";
netstat -an | grep 443 | grep tcp | grep -v 0.0.0.0 | grep -v ::: | cut -d':' -f2 | cut -d' ' -f12 | sort | uniq;
sleep ;
done


One thing to keep in mind is that, if you're behind a VIP, then your web server will only see 1 IP (the one from the VIP). Since this script is checking for unique IP's, it will always show 1 connection. One way to resolve this is to remove the text "| uniq".

10% popularity Vote Up Vote Down


Login to follow query

More posts by @Heady270

0 Comments

Sorted by latest first Latest Oldest Best

Back to top | Use Dark Theme