Solved

Resetting 'netstat' output

Posted on 2011-03-10
3
5,273 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

822 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