Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Example: Configuring an Accounting Profile for Statistics Collection

 

This example shows how to configure an accounting profile for statistics collection.

Requirements

Accounting profiles are supported on M Series Multiservice Edge Routers, MX Series 3D Universal Edge Routers, T Series Core Routers, SRX Series Services Gateways, and EX Series Ethernet Switches with Junos OS Release 7.4 and later. This example uses the following hardware and software components:

  • Junos OS Release 11.2

  • M7i Multiservice Edge router

Note

This configuration example has been tested using the software release listed and is assumed to work on all later releases.

Overview

The procedures in this example describe four tasks for creating a sample ifstats interface profile. The interface profile ifstats specifies that statistics are collected every 5 minutes, and the statistics are written to the file /var/log/ifstats.log.

Configuration

The following example requires you to navigate various levels in the configuration hierarchy. For information about navigating the CLI, see Using the CLI Editor in Configuration Mode in the CLI User Guide.

The accounting profile configuration consists of:

  • Configuring the fields that need to be recorded

  • Configuring when to record the fields

  • Configuring the instances that need accounting

  • Saving the recorded data

Configuring Fields to Be Recorded

The fields to record are configured by choosing a profile type, specifying a name for the profile, and then listing the field names to be recorded. For example, to configure the ifstats interface profile:

  1. Configure the desired fields for the ifstats interface profile at the [edit accounting-options interface-profile ifstats fields] hierarchy level.
  2. Verify the configuration by using the show command at the [edit accounting-options] hierarchy level.

Configuring When to Record Fields

To capture the fields at regular intervals:

  1. Configure the time interval for the ifstats interface profile.
  2. Verify the configuration by using the show command at the [edit accounting-options] hierarchy level.

Configuring Instances That Need Accounting

To configure the interfaces on which the accounting needs to be performed, apply the interface profile to a physical interface or a logical interface by including the accounting-profile statement at either the [edit interfaces interface-name] or the [edit interfaces interface-name unit logical-unit-number] hierarchy level. For example, perform the following steps to apply the ifstats accounting profile to the fe-0/2/3 interface:

  1. Apply the ifstats accounting profile to the fe-0/2/3 interface.
  2. Verify the configuration by using the show command at the [edit interfaces] hierarchy level.

Saving the Recorded Data

To configure the router to save the recorded data to an accounting-data log file:

  1. Configure the accounting-data log file name.
  2. Configure the size of the accounting-data log file.
  3. Verify the configuration by using the show command at the [edit accounting-options] hierarchy level.