Unix How-To: Checking on Collisions

By Sandra Henry-Stocker  Add a new comment

One metric that helps gauge how well your network is holding up to the strain of busy users and applications is the number of packets that slam into other packets, generating what is called a "collision". Let's check out an easy tool for calculating the collision rate for a particular network interface.

To begin this journey into network traffic analysis, we're going to take a look at the output of the netstat -i command that displays stats for the interfaces used for IP traffic. I've straightened up the output below (lined up the columns) to make it make it more readable, but this is the kind of data you would expect to see:

boson$ netstat -i
Name Mtu Net/Dest Address Ipkts Ierrs Opkts Oerrs Collis Queue
lo0 8232 loopback localhost 250528 0 250528 0 0 0
dmfe0 1500 spants spants 136556959 6 173865370 1723663 27690 0
dmfe1 1500 default 0.0.0.0 0 0 0 0 0 0

This is a Sun system with two network interfaces, only of which is un use (dnfe0) and, of course, the loopback (lo0).

The number of collisions tells us how many packets (ethernet frames) ended up colliding (being put on the network medium at the same time as) other packets, the result being that each of them would have to be recalled and resent by their respective network interfaces shortly afterwards. A high collision rate would indicate that the network is very busy, possibly overloaded. The more collisions you have, the more packets have to be resent, the more traffic you have and so on.

You can try using the expr command to calculate the percent of collisions, but you aren't likely to get an answer that's worth much:

boson$ expr 27690 / 173865370
0

You can append a bunch of zeroes to your collision count, but you'll have to then figure out where to put the decimal point when you're done. The answer below represents .015% (one and a half times 1/100th of 1%). In other words, very small.

$ expr 2769000000 / 173865370
15

You can also use grep to grab the two data fields, awk to run the calculation

boson$ netstat -i | grep ^dmfe0 | awk '{print $9 / $7 }'
0.000159242

If you want to turn your commands into a script, you can do something like this to determine which of your network interfaces are operational. Note that we're omitting the loopback in this command.

ifconfig -a | grep -v ^lo | grep UP | awk '{print $1}' | sed 's/://'
dmfe0

A script that runs through all operational interfaces and provides a collision rate might
look like this:

#!/bin/bash

NICS=`ifconfig -a | grep -v ^lo | grep UP | awk '{print $1}' | sed 's/://'`

for if in $NICS
do
    echo -n "$if "
    netstat -i | grep ^$if | awk '{print $9 / $7 }' 2>/dev/null
done
echo

Your output would look something like this:

./getColls
dmfe 0.000159242

The extra caution of sending errors to /dev/null is just in case an interface is active but has seen no traffic. We won't be comitting the high crime of dividing by zero. This is also the reason for the extra echo at the bottom of the script -- to make sure we're not ending without a linefeed.

ITworld LIVE

IT Management/StrategyWhite Papers & Webcasts

White Paper

The Cloud: Reinventing Enterprise Collaboration

Collaboration and content sharing are not, of course, new concepts. But cloud computing has changed the nature of collaboration, content sharing, document storage and project management to enable more efficient, faster-acting and cost-effective enterprises. According to a new study by IDG Research, the vast majority of knowledge workers (86%) placed a very high level of importance on collaborating with internal coworkers and external stakeholders, and having access to the most up-to-date corporate information. Read how organizations are realizing massive productivity gains by transitioning their content management solutions to cloud-based models.

White Paper

Empowering Your Mobile Worker

Today's most productive employees are mobile, and your company's IT strategy must be ready to support them with 24/7 access to the business information they need across a range of mobile devices.See how corporations are meeting the many needs of their mobile workers with the help of Box.

White Paper

Market Landscape Report: Online File Sharing and Collaboration in the Enterprise

The trend toward "consumerization" marches onward in IT; more and more end-users are choosing their own hardware plaforms and software applications in lieu of the IT-sanctioned business tools provided by their companies. These end-users are looking to tackle issues like data sharing, portability, and access from multiple intelligent endpoint devices, creating a conundrum for IT as it needs to balance business enablement, ease of access, and collaborative capacity with the need to maintain control and security of information assets. This need for balance is one of the drivers of the fast growing online file sharing and collaboration segment of the SaaS market. This paper examines the market drivers, inhibitors, and top vendors in this segment, including Box, Citrix Sharefile, Dropbox, Egnyte, Nomadesk, Sugarsync, Syncplicity and YouSendIt.

White Paper

Sharing Simplified - Consolidating File-sharing Technologies

Employees need to share content with colleagues within their organization and outside. Yet, ECMs make it hard to share content within a business and impossible between organizations. Read how one company consolidated multiple file sharing technologies to increase productivity and reduce complexity.

White Paper

Content Sharing 2.0: The Road Ahead

A growing number of companies are taking advantage of the natural synergies that exist between cloud-based IT services and content access and sharing. Legacy content management and collaboration systems simply weren't designed to meet the evolving requirements of today's IT and business managers, as well as the needs of content users. Box provides cloud-based content storage, access and collaboration services that require virtually no user training and supports file access and delivery on almost all popular PC and mobile devices. Read how Box let companies rapidly implement a cost-effective and secure content storage and sharing system that can easily expand to accommodate any size and number of files.

See more White Papers | Webcasts

Ask a question

Ask a Question