Solved

Resetting 'netstat' output

Posted on 2011-03-10
3
4,978 Views
Last Modified: 2012-05-11

Is there any option to reset the 'netstat -i' output in Linux ?  Today we observed heavy packet drops on production linux server. We did some network settings tweak, after which we tried to see if any packet drops are happening. I felt it would be nice if I can clear all the previous packet drops information and start monitoring it from zero values. Please let me know if you know it.

Thanks.
0
Comment
Question by:ashsysad
3 Comments
 
LVL 68

Assisted Solution

by:woolmilkporc
woolmilkporc earned 100 total points
ID: 35106456
Hi,

some netstat implementations support the "-Z" option.

Together with the appropriate option letter it clears the associated statistics:

"netstat -Zc"    - Network Buffer Cache
"netstat -Zi"     - state of all configured interfaces
"netstat -Zm"   - statistics recorded by the memory management routines
"netstat -Zs"    - statistics for each protocol

If this flag is not supported (or used for other purposes), netstat itself will not be capable to clear its statistics.
They will only be reset on reboot.

wmp
0
 
LVL 12

Accepted Solution

by:
upanwar earned 100 total points
ID: 35108003

According to Linux network developers, the network counters are not supposed to be reset. If you really want to this you hack the kernel code to this.

A simple but not so straight forward method is to stop the network interface remove the driver and reload the driver back, this will reset counter values to 0.

http://forums13.itrc.hp.com/service/forums/questionanswer.do?admit=109447627+1299842223781+28353475&threadId=864824
0
 

Author Closing Comment

by:ashsysad
ID: 35113312
Thanks for the explanation guys !!
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
linux boot fsck problem 3 61
Error installing extension Linux 4 58
nagios remote hosts 9 43
VirtualBox in Fedora 25 Linux:  Unable to Install OS 11 141
Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now