[mrtg] Re: Suppressing command-line errors, using perl scripts

Takumi Yamane yamtak at b-session.com
Sat Jan 21 00:56:58 MET 2006


On Fri, 20 Jan 2006 11:53:46 -0500, "Spencer B. Torene" wrote 
in <289B6F0FDB76354FACBFA36D199A2919090C02 at msgsoc.hq.corp.pbs.org>:
> 
> I just got into using Perl scripts on remote servers and MRTG.  One
> remote script, which uses this command-line command:
> 
> "netstat -a -n | grep -E "^(tcp)"| cut -c 68-|sort|uniq -c | sort -n |
> grep TIME_WAIT"
> 
> Is causing a bunch of messages to be sent to the MRTG server that look
> like this:
[snip]
> warning, got bogus tcp line.
[snip]
> so is there a way of suppressing these warnings?

Assuming you are Linux luser:
  man bash
then read a section 'REDIRECTION'
and
  man null

See also http://www.freeos.com/guides/lsst/ch04sec1.html
You got the idea, I hope.


An alternative to your (complex) script:
  netstat --ip -na | awk 'BEGIN {c=0} /^tcp.* TIME_WAIT / {c++} \
    END {print c}'

-- 
Takumi Yamane <yamtak at b-session.com>

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://lists.ee.ethz.ch/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the mrtg mailing list