Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


port_count.sh

 
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates
Author Message
dbenders



Joined: 14 Oct 2002
Posts: 28
Location: Santiago, CHILE

PostPosted: Wed Aug 18, 2004 12:42 am    Post subject: port_count.sh Reply with quote

This script will count the number of opened ports. Is very usefull to count for example POP3, SMTP and HTTP conections.

In order to count remote ports, i.e. for remote servers, just configure the snmpd to transport the info.

Hope this help!


Code:

#!/bin/sh
#
# port_count.sh
#
# Autor         : $Author: dbenders $
# Date          : $Date: 2004/08/16 17:49:42 $
# Version       : $Revision: 1.4 $
# Description   : Count the number of TCP ports opened
#
# Example: port_count.sh 25
#
total=`netstat -tn | grep ":$1 " | awk {'print $4'} | wc -l|awk '{print $1}'`

echo $total

#############################################################################
# END OF FILE
#############################################################################

Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group