Script Check Spesific Port


This scripts’  output show control result for a spesific  port  number  and this  ports’ total  rate. This  script  can be helpful to analyze your  application sockets’  usage  . Just  change PortID and run  for your server. It can be used  for  Linux and  Unix servers.

#!/bin/ksh

totalSocket=netstat -an|wc -l
OBSSocket=netstat -an|grep <portID>|wc -l

ratio=echo "scale=2 ; ($OBSSocket/$totalSocket)" | bc

echo “hostname %$ratio Total $totalSocket  <PORTNAME> $OBSSocket”

Output for 22 port:

Ratio  Total Port   Socket Number

%.02       346          8

 

Tagged In:

I'm a IT Infrastructure and Operations Architect with extensive experience and administration skills and works for Turk Telekom. I provide hardware and software support for the IT Infrastructure and Operations tasks.

205 Total Posts
Follow Me