Solved

Resetting 'netstat' output

Posted on 2011-03-10
3
6,189 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

 Database Backup and Recovery Best Practices

Join Percona’s, Architect, Manjot Singh as he presents Database Backup and Recovery Best Practices (with a Focus on MySQL) on Thursday, July 27, 2017 at 11:00 am PDT / 2:00 pm EDT (UTC-7). In the case of a failure, do you know how long it will take to restore your database?

Question has a verified solution.

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

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
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,…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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…
Suggested Courses

615 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