Solved

Resetting 'netstat' output

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
wifi not working on Raspberry Pi 3? 2 80
Backup Raspberri Pi over the netowrk to a Windows Share 5 52
bash file 10 49
Disabling security updates Ubuntu 3 29
Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
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.

839 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