Configure Accounting Options, Source Class Usage and Destination Class Usage Options
Configuration Statements at the [edit accounting-options] Hierarchy Level
This topic shows all possible configuration statements at the [edit accounting-options]
hierarchy level and their level in
the configuration hierarchy. When you are configuring Junos OS, your
current hierarchy level is shown in the banner on the line preceding
the user@host#
prompt.
[edit] accounting-options { class-usage-profile profile-name { file filename; interval minutes; destination-classes { destination-class-name; } source-classes { source-class-name; } } file filename { archive-sites { } files number; nonpersistent; size bytes; start-time time; transfer-interval minutes; } filter-profile profile-name { counters { counter-name; } file filename; interval minutes; } } interface-profile profile-name { fields { field-name; } file filename; interval minutes; } mib-profile profile-name { file filename; interval seconds; object-names { mib-object-name; } operation operation-name; } routing-engine-profile profile-name { fields { field-name; } file filename; interval minutes; }
Accounting Options Configuration
This topic contains the following sections:
Accounting Options—Full Configuration
To configure accounting options, include the following statements
at the [edit accounting-options]
hierarchy level:
accounting-options { class-usage-profile profile-name { file filename; interval minutes; destination-classes { destination-class-name; } source-classes { source-class-name; } file filename { archive-sites { site-name; } files number; nonpersistent; size bytes; source-classes time; transfer-interval minutes; } filter-profile profile-name { counters { counter-name; } file filename; interval minutes; } } flat-file-profile profile-name{ fields { all-fields; egress-stats { all-fields; input-bytes; input-packets; output-bytes; output-packets; queue-id; red-drop-bytes; red-drop-packets; tail-drop-packets; total-drop-packets; } general-param { all-fields; accounting-type; descr; line-id; logical-interface; nas-port-id; physical-interface; routing-instance; timestamp; vlan-id; } ingress-stats { all-fields; drop-packets; input-bytes; input-packets; output-bytes; output-packets; queue-id; } l2-stats { all-fields; input-mcast-bytes; input-mcast-packets; } fields { all-fields; egress-stats { all-fields; input-bytes; input-packets; output-bytes; output-packets; queue-id; red-drop-bytes; red-drop-packets; tail-drop-packets; total-drop-packets; } general-param { all-fields; accounting-type; descr; line-id; logical-interface; nas-port-id; physical-interface; routing-instance; timestamp; vlan-id; } ingress-stats { all-fields; drop-packets; input-bytes; input-packets; output-bytes; output-packets; queue-id; } general-param { all-fields; accounting-type; descr; line-id; logical-interface; nas-port-id; physical-interface; routing-instance; timestamp; vlan-id; } ingress-stats { all-fields; drop-packets; input-bytes; input-packets; output-bytes; output-packets; queue-id; } l2-stats { all-fields; input-mcast-bytes; input-mcast-packets; } overall-packet { all-fields; input-bytes; input-discards; input-errors; input-packets; inputv6-bytes; inputv6-packets; output-bytes; output-errors; output-packets; outputv6-bytes; outputv6-packets; input-v4-bytes; input-v4-packets; output-v4-bytes; output-v4-packets; input-bytes-per-sec; input-packets-per-sec; } } file filename; format (csv | ipdr) interval minutes; schema-version schema-name; } interface-profile profile-name { fields { field-name; } file filename; interval minutes; } mib-profile profile-name { file filename; interval (Accounting Options) seconds; object-names { mib-object-name; } operation operation-name; } routing-engine-profile profile-name { fields { field-name; } file filename; interval minutes; } } }
By default, accounting options are disabled.
Do not configure MIB objects related to interface octets or packets for a MIB profile, because doing so can cause the SNMP walk or a CLI show command to time out.
Minimum Accounting Options Configuration
To enable accounting options on the router, you must perform at least the following tasks:
Configure accounting options by including a
file
statement and one or moresource-class-usage
,destination-class-profile
,filter-profile
,interface-profile
,mib-profile
, orrouting-engine-profile
statements at the[edit accounting-options]
hierarchy level:[edit] accounting-options { class-usage-profile profile-name { file filename; interval minutes; source-classes { source-class-name; } destination-classes { destination-class-name; } file filename { archive-sites { site-name; } files number; size bytes; transfer-interval minutes; } filter-profile profile-name { counters { counter-name; } file filename; interval minutes; } flat-file-profile profile-name{ fields { all-fields; egress-stats { all-fields; input-bytes; input-packets; output-bytes; output-packets; queue-id; red-drop-bytes; red-drop-packets; tail-drop-packets; total-drop-packets; } general-param { all-fields; accounting-type; descr; line-id; logical-interface; nas-port-id; physical-interface; routing-instance; timestamp; vlan-id; } ingress-stats { all-fields; drop-packets; input-bytes; input-packets; output-bytes; output-packets; queue-id; } l2-stats { all-fields; input-mcast-bytes; input-mcast-packets; } overall-packet { all-fields; input-bytes; input-discards; input-errors; input-packets; inputv6-bytes; inputv6-packets; output-bytes; output-errors; output-packets; outputv6-bytes; outputv6-packets; input-v4-bytes; input-v4-packets; output-v4-bytes; output-v4-packets; input-bytes-per-sec; input-packets-per-sec; } } file filename; format (csv | ipdr) interval minutes; schema-version schema-name; } flat-file-profile profile-name{ fields { all-fields; egress-stats { all-fields; input-bytes; input-packets; output-bytes; output-packets; queue-id; red-drop-bytes; red-drop-packets; tail-drop-packets; total-drop-packets; } general-param { all-fields; accounting-type; descr; line-id; logical-interface; nas-port-id; physical-interface; routing-instance; timestamp; vlan-id; } ingress-stats { all-fields; drop-packets; input-bytes; input-packets; output-bytes; output-packets; queue-id; } l2-stats { all-fields; input-mcast-bytes; input-mcast-packets; } overall-packet { all-fields; input-bytes; input-discards; input-errors; input-packets; inputv6-bytes; inputv6-packets; output-bytes; output-errors; output-packets; outputv6-bytes; outputv6-packets; input-v4-bytes; input-v4-packets; output-v4-bytes; output-v4-packets; input-bytes-per-sec; input-packets-per-sec; } } file filename; format (csv | ipdr) interval minutes; schema-version schema-name; } interface-profile profile-name { fields { field-name; } file filename; interval minutes; } mib-profile profile-name { file filename; interval minutes; object-names { mib-object-name; } operation operation-name; } routing-engine-profile profile-name { fields { field-name; } file filename; interval minutes; } } }
Apply the profiles to the chosen interfaces or filters.
Apply an interface profile to a physical or 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.[edit interfaces] interface-name { accounting-profile profile-name; unit logical-unit-number { accounting-profile profile-name; } }
Note:You do not apply destination class profiles to interfaces. Although the interface needs to have the
destination-class-usage
statement configured, the destination class profile automatically finds all interfaces with the destination class configured.Apply a filter profile to a firewall filter by including the
accounting-profile
statement at the[edit firewall filter filter-name]
hierarchy level:[edit firewall] filter filter-name { accounting-profile profile-name; }
You do not need to apply the Routing Engine profile to an interface because the statistics are collected on the Routing Engine itself.
Configure Accounting-Data Log Files
An accounting profile specifies what statistics to collect
and write to a log file. To configure an accounting-data log file,
include the file
statement at the [edit accounting-options]
hierarchy level:
[edit accounting-options] cleanup-interval { interval days; } file filename { archive-sites { site-name; } backup-on-failure (master-and-slave | master-only); files number; nonpersistent; push-backup-to-master; size bytes; start-time time; transfer-interval minutes; }
where filename
is the name of
the file in which to write accounting data.
If the filename contains spaces, enclose it in quotation marks
(" "). The filename cannot contain a forward slash (/
). The file is created in the /var/log
directory and can
contain data from multiple profiles.
All accounting-data log files include header and trailer sections
that start with a #
in the first column. The header contains
the file creation time, the hostname, and the columns that appear
in the file. The trailer contains the time that the file was closed.
Whenever any configured value changes that affects the columns in a file, the file creates a new profile layout record that contains a new list of columns.
You must configure the file size; all other properties are optional.
- Configure How Long Backup Files Are Retained
- Configure the Maximum Size of the File
- Configure Archive Sites for the Files
- Configure Local Backup for Accounting Files
- Configure Files to Be Compressed
- Configure the Maximum Number of Files
- Configure the Storage Location of the File
- Configure Files to Be Saved After a Change in Primary Role
- Configure the Start Time for File Transfer
- Configure the Transfer Interval of the File
Configure How Long Backup Files Are Retained
You can configure how many days the files are retained in the local directory before they are deleted.
Files saved to the /var/log/pfedBackup directory are always compressed to conserve local storage, regardless
of whether the compress
statement is configured.
To configure retention for backup files:
Specify the number of days.
[edit accounting-options] user@host# set cleanup-interval interval days
Files are retained for 1 day if you do not configure this option.
This value, whether configured or default, applies to all configured
files at the [edit accounting-options file]
hierarchy level.
Configure the Maximum Size of the File
To configure the maximum size of the file:
The size
statement is the maximum size of the log
file, in bytes, kilobytes (KB), megabytes (MB), or gigabytes (GB).
The minimum value for bytes
is 256
KB. You must configure bytes
; the
remaining attributes are optional.
Configure Archive Sites for the Files
After a file reaches its maximum size or the transfer-interval
time is exceeded, the file is closed, renamed, and, if you configured
an archive site, transferred to a remote host.
To configure the sites where files are archived:
Specify one or more site names.
[edit accounting-options file filename] user@host# set archive-sites site-name
where site-name
is any valid
FTP URL. For more information about specifying valid FTP URLs, see
the Junos OS Administration Library. You can specify more than one URL, in any order. When a file is
archived, the router or switch attempts to transfer the file to the
first URL in the list, trying the next site in the list only if the
transfer does not succeed. The log file is stored at the archive site
with a filename of the format router-name_log-filename_timestamp
. When you configure
file archival by using archive-states
statement, the transfer
file utility uses the default routing instance to connect to the destination
server. If the default routing instance is unable to connect to the
destination server, the transfer file utility does not work.
Starting in Junos OS
18.4R1, when you configure file archival by using the archive-sites
statement, the transfer file utility does not work if you have enabled
the management instance.
Configure Local Backup for Accounting Files
You can configure the router to save a copy of the accounting file locally when the normal transfer of the files to the archive site fails. The file is saved to the /var/log/pfedBackup directory of the relevant Routing Engine. You must specify whether only the files from the primary Routing Engine are saved or files are saved from both the primary Routing Engine and the backup (client) Routing Engine.
Files saved to the /var/log/pfedBackup directory are always compressed to conserve local storage, regardless
of whether the compress
statement is configured.
To configure local backup in the event of failure:
Specify local backup and which files are saved.
[edit accounting-options file filename] user@host# set backup-on-failure (master-and-slave | master-only)
Disabling this feature deletes the backed-up accounting files from the directory.
When you do not configure this option, the file is saved on failure into the local directory specified as the last site in the list of archive sites.
Configure Files to Be Compressed
By default, accounting files are transferred in an uncompressed format. To conserve resources during transmission and on the archive site, you can configure compression for the files.
Files saved to the /var/log/pfedBackup directory are always compressed to conserve local storage, regardless
of whether the compress
statement is configured.
To configure the router to compress accounting files when they are transferred:
Specify compression.
[edit accounting-options file filename] user@host# set compress
Configure the Maximum Number of Files
To configure the maximum number of files:
Specify the number.
[edit accounting-options file filename] user@host# set files number
When a log file reaches its maximum size, it is renamed filename.0
, then filename.1
, and so on, until the maximum number of log files is reached.
Then the oldest log file is overwritten. The minimum value for number
is 3 and the default value is 10.
Configure the Storage Location of the File
On J Series Services Routers, the files are stored by default
on the compact flash drive. Alternatively, you can configure the files
to be stored in the mfs/var/log directory
(on DRAM) instead of the cf/var/log
directory (on the compact
flash drive).
To configure the storage location on DRAM:
Specify nonpersistent storage.
[edit accounting-options file filename] user@host# set nonpersistent
This feature is useful for minimizing read/write traffic on the router’s compact flash drive.
If log files for accounting data are stored on DRAM, these files are lost when you reboot the router. We recommend that you back up these files periodically.
Configure Files to Be Saved After a Change in Primary Role
You can configure the router to save the accounting files from the new backup Routing Engine to the new primary Routing Engine when a change in primary role occurs. The files are stored in the /var/log/pfedBackup directory on the router. The primary Routing Engine includes these accounting files with its own current accounting files when it transfers the files from the backup directory to the archive site at the next transfer interval. Configure this option when the new backup Routing Engine is not able to connect to the archive site; for example, when the site is not connected by means of an out-of-band interface or the path to the site is routed through a line card.
To configure the backup Routing Engine files to be saved when primary role changes:
Specify the backup.
[edit accounting-options file filename] user@host# set push-backup-to-master
The backup Routing Engine’s files on the primary
Routing Engine are sent at each interval even though the files remain
the same. If this is more activity than you want, consider using the backup-on-failure master-and-slave
statement instead.
Configure the Start Time for File Transfer
To configure the start time for transferring files:
Specify the time.
[edit accounting-options file filename] user@host# set start-time YYYY-MM-DD.hh:mm
For example, 10:00 a.m. on January 30, 2007 is represented as 2007-01-30.10:00
.
Configure the Transfer Interval of the File
To configure the interval at which files are transferred:
Specify the interval.
[edit accounting-options file filename] user@host# set transfer-interval minutes
The range for transfer-interval
is 5 through 2880 minutes.
The default is 30 minutes.
Junos OS saves the existing log file and creates a new file at the configured transfer intervals irrespective of whether:
The file has reached the maximum size.
An archive site is configured.
When you have a relatively small transfer interval configured and if no archive site is configured, data can be lost as Junos OS overwrites the log files when the maximum number of log files is reached. To ensure that the log information is saved for a reasonably long time:
Configure an archive site to archive the log files every time a new log file is created.
Configure the maximum value (2880 minutes) for
transfer-interval
so that new files are created less frequently; that is, only when the file exceeds the maximum size limit or once in 2 days.
Manage Accounting Files
If you configure SRX300, SRX320, SRX340, SRX345, SRX550M, SRX1500, SRX4100, SRX4200, and SRX4600 devices to capture accounting data in log files, set the location for your accounting files to the DRAM.
The default location for accounting files is the cfs/var/log
directory on the CompactFlash (CF) card. The nonpersistent
option minimizes the read/write traffic to your CF card. We recommend
that you use the nonpersistent
option for all accounting
files configured on your system.
To store accounting log files in DRAM instead of the CF card:
If log files for accounting data are stored on DRAM, these files are lost when the device reboots. Therefore, we recommend that you back up these files periodically.
The CLI nonpersistent
option is not supported on SRX5000 line.
Configure the Interface Profile
An interface profile specifies the information collected and written to a log file. You can configure a profile to collect error and statistic information for input and output packets on a particular physical or logical interface.
To configure an interface profile, include the interface-profile
statement at the [edit accounting-options]
hierarchy
level:
[edit accounting-options] interface-profile profile-name { fields { field-name; } file filename; interval minutes; }
By default, the Packet Forwarding Engine (PFE) periodically
collects the statistics for all interfaces. To improve the performance,
you can optionally disable the periodic refresh by including the periodic-refresh disable
statement at the [edit accounting-options]
hierarchy level.
Each accounting profile must have a unique profile-name
. To apply a profile to a physical or logical interface, include
the accounting-profile
statement at either the [edit
interfaces interface-name]
or the [edit interfaces interface-name unit logical-unit-number]
hierarchy level. You can also
apply an accounting profile at the [edit firewall family family-type filter filter-name]
hierarchy level. For more information, see the Routing Policies, Firewall Filters, and Traffic Policers User Guide.
To configure an interface profile, perform the tasks described in the following sections:
- Configure Fields
- Configure the File Information
- Configure Cleared Statistics to be Reported in the Flat File
- Configure the Interval
- Example: Configure the Interface Profile
Configure Fields
An interface profile must specify what statistics are
collected. To configure which statistics should be collected for an
interface, include the fields
statement at the [edit
accounting-options interface-profile profile-name]
hierarchy level:
[edit accounting-options interface-profile profile-name] fields { field-name; }
Configure the File Information
Each accounting profile logs its statistics to a file in the /var/log directory.
To configure which file to use, include the file
statement at the [edit accounting-options interface-profile profile-name]
hierarchy level:
[edit accounting-options interface-profile profile-name] file filename;
You must specify a file
statement for the interface
profile that has already been configured at the [edit accounting-options]
hierarchy level.
Configure Cleared Statistics to be Reported in the Flat File
When you issue the clear interfaces
statistics
command for a logical interface configured
to collect accounting statistics, all accounting statistics received
on that interface from the Packet Forwarding Engine are cleared. The
current values when the command is issued become the new baseline
and the statistics counters are reset to zero. The new values, starting
from zero, are displayed in the CLI. However, they are not reported
that way in the accounting flat file associated with the interface.
Instead, the values as reported in the file continue to increment
as if the command had not been issued.
You can change this result by including the allow-clear
statement in the interface profile. In this case, when you issue
the clear interfaces statistics
command, the statistics
are reset to zero and reported to the flat file.
To configure reporting of cleared accounting statistics to the flat file, specify reporting:
[edit accounting-options interface-profile profile-name] allow-clear;
Configure the Interval
Each interface with an accounting profile enabled has
statistics collected once per interval time specified for the accounting
profile. Statistics collection time is scheduled evenly over the configured
interval. To configure the interval, include the interval
statement at the [edit accounting-options interface-profile profile-name]
hierarchy level:
[edit accounting-options interface-profile profile-name] interval minutes;
The minimum interval allowed is 1 minute. Configuring a low interval in an accounting profile for a large number of interfaces might cause serious performance degradation.
The range for the interval
statement is 1 through
2880 minutes. The default is 30 minutes.
Example: Configure the Interface Profile
Configure the interface profile:
[edit] accounting-options { file if_stats { size 40 files 5; } interface-profile if_profile1 { file if_stats; interval 30; fields { input-bytes; output-bytes; input-packets; output-packets; input-multicast; output-multicast; } } interface-profile if_profile2 { file if_stats; interval 30; fields { input-bytes; output-bytes; input-packets; output-packets; input-multicast; output-multicast; } } interfaces { xe-1/0/0 { accounting-profile if_profile1; unit 0 { accounting-profile if_profile2; ... } } } }
The two interface profiles, if-profile1 and if-profile2, write data to the same file, if-stats. The if-stats file might look like the following:
#FILE CREATED 976823478 2000-12-14-19:51:18 #hostname host #profile-layout if_profile2,epoch-timestamp,interface-name,snmp-index,input-bytes,output-bytes, input-packets,output-packets,input-multicast,output-multicast #profile-layout if_profile1,epoch-timestamp,interface-name,snmp-index,input-bytes,output-bytes, input-packets if_profile2,976823538,xe-1/0/0.0,8,134696815,3681534,501088,40723,0,0 if_profile1,976823538,xe-1/0/0,7,134696815,3681534,501088 ... #FILE CLOSED 976824378 2000-12-14-20:06:18
Configure the Filter Profile
A filter profile specifies error and statistics information collected and written to a file. A filter profile must specify counter names for which statistics are collected.
To configure a filter profile, include the filter-profile
statement at the [edit accounting-options]
hierarchy
level:
[edit accounting-options] filter-profile profile-name { counters { counter-name; } file filename; interval minutes; }
To apply the filter profile, include the accounting-profile
statement at the [edit firewall filter filter-name]
hierarchy level.
To configure a filter profile, perform the tasks described in the following sections:
Configure the Counters
Statistics are collected for all counters specified in
the filter profile. To configure the counters, include the counters
statement at the [edit accounting-options filter-profile profile-name]
hierarchy level:
[edit accounting-options filter-profile profile-name] counters { }
Configure the File Information
Each accounting profile logs its statistics to a file in the /var/log
directory.
To configure which file to use, include the file
statement at the [edit accounting-options filter-profile profile-name]
hierarchy level:
[edit accounting-options filter-profile profile-name] file filename;
You must specify a filename for the filter profile that has
already been configured at the [edit accounting-options]
hierarchy level.
The limit on the total number of characters per line in a log file equals 1023. If this limit is exceeded, the output written to the log file is incomplete. Ensure that you limit the number of counters or requested data so that this character limit is not exceeded.
If the configured file size or transfer interval is exceeded, Junos OS closes the file and starts a new one. By default, the transfer interval value is 30 minutes. If the transfer interval is not configured, Junos OS closes the file and starts a new one when the file size exceeds its configured value or the default transfer interval value exceeds 30 minutes. To avoid transferring files every 30 minutes, specify a different value for the transfer interval.
Configure the Interval
Each filter with an accounting profile enabled has statistics
collected once per interval time specified for the accounting profile.
Statistics collection time is scheduled evenly over the configured
interval. To configure the interval, include the interval
statement at the [edit accounting-options filter-profile profile-name]
hierarchy level:
[edit accounting-options filter-profile profile-name] interval;
The minimum interval allowed is 1 minute. Configuring a low interval in an accounting profile for a large number of filters might cause serious performance degradation.
The range for the interval
statement is 1 through
2880 minutes. The default is 30 minutes.
Example: Configure a Filter Profile
Configure a filter profile:
[edit] accounting-options { file fw_accounting { size 500k files 4; } filter-profile fw_profile1 { file fw_accounting; interval 60; counters { counter1; counter2; counter3; } } } firewall { filter myfilter { accounting-profile fw_profile1; ... term accept-all { then { count counter1; accept; } } } }
The filter profile, fw-profile1
, writes data to the
file fw_accounting
. The file might look like the following:
#FILE CREATED 976825278 2000-12-14-20:21:18 #hostname host #profile-layout fw_profile1,epoch-timestamp,filter-name,counter-name,packet-count,byte-count fw_profile1,976826058,myfilter,counter1,163,10764 ... #FILE CLOSED 976826178 2000-12-14-20:36:18
Example: Configure Interface-Specific Firewall Counters and Filter Profiles
To collect and log count statistics collected by firewall filters
on a per-interface basis, you must configure a filter profile and
include the interface-specific statement at the [edit firewall
filter filter-name]
hierarchy level.
Configure the firewall filter accounting profile:
[edit accounting-options] file cust1_accounting { size 500k; } filter-profile cust1_profile { file cust1_accounting; interval 1; counters { r1; } }
Configure the interface-specific firewall counter:
[edit firewall] filter f3 { accounting-profile cust1_profile; interface-specific; term f3-term { then { count r1; accept; } } }
Apply the firewall filter to an interface:
[edit interfaces] xe-1/0/0 { unit 0 { family inet { filter { input f3; output f3; } address 20.20.20.30/24; } } }
The following example shows the contents of the cust1_accounting
file in the /var/log
folder that might result from the
preceding configuration:
#FILE CREATED 995495212 2001-07-18-22:26:52 #hostname host #profile-layout cust1_profile,epoch-timestamp,interfaces,filter-name, counter-name,packet-count,byte-count cust1_profile,995495572,xe-1/0/0.0,f3-xe-1/0/0.0-i,r1-xe-1/0/0.0-i,5953,1008257 cust1_profile,995495602,xe-1/0/0.0,f3-xe-1/0/0.0-o,r1-xe-1/0/0.0-o,5929,1006481 ...
If the interface-specific
statement is not included
in the configuration, the following output might result:
#FILE CREATED 995495212 2001-07-18-22:26:52 #hostname host #profile-layout cust1_profile,epoch-timestamp,interfaces,filter-name, counter-name,packet-count,byte-count cust1_profile,995495572,xe-1/0/0.0,f3,r1,5953,1008257 cust1_profile,995495632,xe-1/0/0.0,f3,r1,5929,1006481
Configure Class Usage Profiles
To collect class usage statistics, perform the tasks described in these sections:
- Configure a Class Usage Profile
- Configure the File Information
- Configure the Interval
- Create a Class Usage Profile to Collect Source Class Usage Statistics
- Create a Class Usage Profile to Collect Destination Class Usage Statistics
Configure a Class Usage Profile
You can configure the class usage profile to collect statistics for particular source and destination classes.
To configure the class usage profile to filter by source
classes, include the source-classes
statement at the [edit accounting-options class-usage-profile profile-name]
hierarchy level:
[edit accounting-options class-usage-profile profile-name] source-classes { source-class-name; }
To configure the class usage profile to filter by destination
classes, include the destination-classes
statement at the [edit accounting-options class-usage-profile profile-name]
hierarchy level:
[edit accounting-options class-usage-profile profile-name] destination-classes { destination-class-name; }
Configure the File Information
Each accounting profile logs its statistics to a file in the /var/log
directory.
To specify which file to use, include the file
statement at the [edit accounting-options class-usage-profile profile-name]
hierarchy level:
[edit accounting-options class-usage-profile profile-name] file filename;
You must specify a filename for the source class usage profile
that has already been configured at the [edit accounting-options]
hierarchy level. You can also specify a filename for the destination
class usage profile configured at the [edit accounting-options]
hierarchy level.
Configure the Interval
Each interface with a class usage profile enabled has
statistics collected once per interval specified for the accounting
profile. Statistics collection time is scheduled evenly over the configured
interval. To configure the interval, include the interval
statement at the [edit accounting-options class-usage-profile profile-name]
hierarchy level:
[edit accounting-options class-usage-profile profile-name] interval;
Create a Class Usage Profile to Collect Source Class Usage Statistics
To create a class usage profile to collect source class usage statistics:
[edit] accounting-options { class-usage-profile scu-profile1; file usage-stats; interval 15; source-classes { gold; silver; bronze; } }
The class usage profile, scu-profile1
, writes data
to the file usage_stats
. The file might look like the following:
#FILE CREATED 976825278 2000-12-14-20:21:18 #profile-layout, scu_profile,epoch-timestamp,interface-name,source-class, packet-count,byte-count scu_profile,980313078,xe-1/0/0.0,gold,82,6888 scu_profile,980313078,xe-1/0/0.0,silver,164,13776 scu_profile,980313078,xe-1/0/0.0,bronze,0,0 scu_profile,980313678,xe-1/0/0.0,gold,82,6888 scu_profile,980313678,xe-1/0/0.0,silver,246,20664 scu_profile,980313678,xe-1/0/0.0,bronze,0,0
Create a Class Usage Profile to Collect Destination Class Usage Statistics
To create a class usage profile to collect destination class usage statistics:
[edit] accounting-options { class-usage-profile dcu-profile1; file usage-stats interval 15; destination-classes { gold; silver; bronze; } }
The class usage profile, dcu-profile1
, writes data
to the file usage-stats
. The file might look like the following:
#FILE CREATED 976825278 2000-12-14-20:21:18 #profile-layout, dcu_profile,epoch-timestamp,interface-name,destination-class, packet-count,byte-count dcu_profile,980313078,xe-1/0/0.0,gold,82,6888 dcu_profile,980313078,xe-1/0/0.0,silver,164,13776 dcu_profile,980313078,xe-1/0/0.0,bronze,0,0 dcu_profile,980313678,xe-1/0/0.0,gold,82,6888 dcu_profile,980313678,xe-1/0/0.0,silver,246,20664 dcu_profile,980313678,xe-1/0/0.0,bronze,0,0 ... #FILE CLOSED 976826178 2000-12-14-20:36:18
Configure the MIB Profile
The MIB profile collects MIB statistics and logs them to a file. The MIB profile specifies the SNMP operation and MIB object names for which statistics are collected.
To configure a MIB profile, include the mib-profile
statement at the [edit accounting-options]
hierarchy
level:
[edit accounting-options] mib-profile profile-name { file filename; interval minutes; object-names { mib-object-name; } operation operation-name; }
To configure a MIB profile, perform the tasks described in the following sections:
- Configure the File Information
- Configure the Interval
- Configure the MIB Operation
- Configure MIB Object Names
- Example: Configure a MIB Profile
Configure the File Information
Each accounting profile logs its statistics to a file in the /var/log
directory.
To configure which file to use, include the file
statement at the [edit accounting-options mib-profile profile-name]
hierarchy level:
[edit accounting-options mib-profile profile-name] file filename;
You must specify a filename for the MIB
profile that has already been configured at the [edit accounting-options]
hierarchy level.
Configure the Interval
A MIB profile has statistics collected once per interval
time specified for the profile. Statistics collection time is scheduled
evenly over the configured interval. To configure the interval, include
the interval
statement at the [edit accounting-options
mib-profile profile-name]
hierarchy level:
[edit accounting-options mib-profile profile-name] interval;
The range for the interval
statement is 1 through
2880 minutes. The default is 30 minutes.
Configure the MIB Operation
A MIB profile must specify the operation that is used
to collect MIB statistics. To configure which operation is used to
collect MIB statistics, include the operation
statement
at the [edit accounting-options mib-profile profile-name]
hierarchy level:
[edit accounting-options mib-profile profile-name] operation operation-name;
You can configure a get
, get-next
, or walk
operation. The default operation is walk
.
Configure MIB Object Names
A MIB profile must specify the MIB objects for which
statistics are to be collected. To configure the MIB objects for which
statistics are collected, include the objects-names
statement
at the [edit accounting-options mib-profile profile-name]
hierarchy level:
[edit accounting-options mib-profile profile-name] object-names { mib-object-name; }
You can include multiple MIB object names in the configuration.
In Junos OS Release 15.1X49-D10 and later, do not configure MIB objects related to interface octets or packets for a MIB profile, because it can cause the SNMP walk or a CLI show command to time out.
Example: Configure a MIB Profile
Configure a MIB profile:
[edit accounting-options] mib-profile mstatistics { file stats; interval 60; operation walk; objects-names { ipCidrRouteStatus; } }
Configure the Routing Engine Profile
The Routing Engine profile collects Routing Engine statistics and logs them to a file. The Routing Engine profile specifies the fields for which statistics are collected.
To configure a Routing Engine profile, include the routing-engine-profile
statement at the [edit accounting-options]
hierarchy level:
[edit accounting-options] routing-engine-profile profile-name { fields { field-name; } file filename; interval minutes; }
To configure a Routing Engine profile, perform the tasks described in the following sections:
- Configure Fields
- Configure the File Information
- Configure the Interval
- Example: Configure a Routing Engine Profile
Configure Fields
A Routing Engine profile must specify what statistics
are collected. To configure which statistics should be collected for
the Routing Engine, include the fields
statement at the [edit accounting-options routing-engine-profile profile-name]
hierarchy level:
[edit accounting-options routing-engine-profile profile-name] fields { field-name; }
Configure the File Information
Each accounting profile logs its statistics to a file in the /var/log
directory.
To configure which file to use, include the file
statement at the [edit accounting-options routing-engine-profile profile-name]
hierarchy level:
[edit accounting-options routing-engine-profile profile-name] file filename;
You must specify a filename for the Routing
Engine profile that has already been configured at the [edit
accounting-options]
hierarchy level.
Configure the Interval
A Routing Engine profile has statistics collected once
per interval time specified for the profile. Statistics collection
time is scheduled evenly over the configured interval. To configure
the interval, include the interval
statement at the [edit accounting-options routing-engine-profile profile-name]
hierarchy level:
[edit accounting-options routing-engine-profile profile-name] interval;
The range for interval
is 1 through 2880 minutes.
The default is 30 minutes.
Example: Configure a Routing Engine Profile
Configure a Routing Engine profile:
[edit accounting-options] file my-file { size 300k; } routing-engine-profile profile-1 { file my-file; fields { host-name; date; time-of-day; uptime; cpu-load-1; cpu-load-5; cpu-load-15; } }
Change History Table
Feature support is determined by the platform and release you are using. Use Feature Explorer to determine if a feature is supported on your platform.
archive-sites
statement, the transfer file utility does not work if you have enabled
the management instance.