Thanks, it's better now.
________________________________
From: owner-m...@openbsd.org <owner-m...@openbsd.org> on behalf of Claudio 
Jeker <cje...@diehard.n-r-g.com>
Sent: Thursday, June 10, 2021 12:33 PM
To: misc@openbsd.org <misc@openbsd.org>
Subject: Re: Howto measure pps at forwarding plane

On Thu, Jun 10, 2021 at 09:23:03AM -0000, Stuart Henderson wrote:
> On 2021-06-10, Valdrin MUJA <valdrin_m...@outlook.com> wrote:
> > Hello,
> >
> > I'm trying to figure out how much packets are being forwarded on my OpenBSD 
> > firewall.
> > Here a small script i wrote.
> >
> >
> > #!/bin/sh
> >
> >
> > VAL1=`netstat -s | grep 'packets forwarded' | head -1 | awk -F ' ' '{print 
> > $1}'`
> >
> > sleep 1
> >
> > VAL2=`netstat -s | grep 'packets forwarded' | head -1 | awk -F ' ' '{print 
> > $1}'`
> >
> >
> > echo "$(($VAL2-$VAL1))"
> >
> >
> > But i can not be sure if i am doing the right thing?
> > Can anyone check it please.
> > Thanks.
> >
>
> If you are only interested in IPv4 then yes that'll do it.
> This would save some cpu cycles though:
>
> VAL1=`netstat -s | awk '/packets forwarded/ { print $1; exit }'`
>

And use netstat -spip which limits the number of sysctls made in netstat.

--
:wq Claudio

Reply via email to