Simple Port Accounting – part 2

A small addition to the previous post about port accounting with iptables and mrtg.

A new script to count tcp and udp connections.
conns.sh

#!/bin/bash
HOSTNAME="/bin/hostname"
NETSTAT="/bin/netstat"
UPTIME="/usr/bin/uptime"
$NETSTAT -ant | grep -v LISTEN | grep -v Active | grep -v Proto | wc -l
$NETSTAT -anu | grep -v LISTEN | grep -v Active | grep -v Proto | wc -l
$UPTIME | awk '{ print $3, $4, $5 }'
$HOSTNAME

and the part that goes inside your mrtg.conf


Target[conns]: `/etc/mrtg/conns.sh`
Options[conns]: growright, nopercent, gauge
MaxBytes[conns]: 20000
Title[conns]: Connections
YLegend[conns]: Connections
LegendI[conns]:  TCP:
LegendO[conns]:  UDP:
ShortLegend[conns]: conns
PageTop[conns]: <h1>Connection Stats </h1 >

enjoy 🙂 It works for me..I hope it works for you too 🙂

American Judges are nothing more than farmers

Where do american people study to become judges ? How can so foolish people become judges ? Just check this news from a Minessota court…

A Minnesota appeals court has ruled that the presence of encryption software on a computer may be viewed as evidence of criminal intent.

Read about this hilarious matter.. I don’t care if the guy was in child pr0n industry…let him rot in jail…but PGP is NOT evidence that someone is using the power of the dark force to conquer the world. Make this judge a favour and sent him home to farm his fields…

grrrrrrr