All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anton Danilov <littlesmilingcloud@gmail.com>
To: lartc@vger.kernel.org
Subject: Re: Route count
Date: Wed, 10 Feb 2021 08:11:40 +0000	[thread overview]
Message-ID: <CAEzD07K4TsxXt2e+h7Ch=ywjDd0wL+t2mpTCQR9aq+4ZTfxboQ@mail.gmail.com> (raw)
In-Reply-To: <99dad522-5d1b-0d22-e215-9ee25e079ba3@spamtrap.tnetconsulting.net>

Hello.
Instead of fetching all content of a route table, you can parse the
/proc/net/fib_triestat file. It contents the number of prefixes for
every routing table.

On Mon, 8 Feb 2021 at 20:13, Grant Taylor <gtaylor@tnetconsulting.net> wrote:
>
> Hi,
>
> Does anyone know a more efficient way to get a count of the number of
> routes than to do something like the following?
>
>     # ip route show table $TABLE | wc -l
>
> I'm doing something where I'd like to instrument the number of
> (unreachable / null) routes once a minute and I'd like to avoid
> unnecessary load on the system.
>
> It seems to me like there should be a counter somewhere that I can just
> read instead of needing to enumerate every single route in the table.
>
>
>
> --
> Grant. . . .
> unix || die
>


-- 
Anton Danilov.

  reply	other threads:[~2021-02-10  8:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-08 17:10 Route count Grant Taylor
2021-02-10  8:11 ` Anton Danilov [this message]
2021-02-10 16:46 ` Grant Taylor
2021-02-10 16:53 ` Grant Taylor
2021-02-10 19:11 ` Jay Vosburgh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAEzD07K4TsxXt2e+h7Ch=ywjDd0wL+t2mpTCQR9aq+4ZTfxboQ@mail.gmail.com' \
    --to=littlesmilingcloud@gmail.com \
    --cc=lartc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.