# Monitoring J-Flow Statistics

This section shows how to clear J-Flow statistics and use the show commands to view J-Flow settings and statistical results.

## Clearing J-Flow Statistics

Use the clear ip flow stats command to clear all entries from all flow caches on the virtual router.

clear ip flow stats

- Use to clear entries from all flow caches on the VR/VRF.
- Example
  host1(config)#clear ip flow stats
- There is no no version.
- See clear ip flow stats.

## J-Flow show Commands

You can monitor the following aspects of J-Flow statistics by using the following commands:

To Display | Command
--- | ---
Main cache flow operational statistics | show ip cache flow
J-Flow sampling state | show ip flow sampling
J-Flow export state and export statistics | show ip flow export

You can use the output filtering feature of the show command to include or exclude lines of output based on a text string that you specify. See Command Line Interface in JunosE System Basics Configuration Guide, for details.

show ip cache flow

- Use to display IP flow cache operational statistics.
- Field descriptions
  - Main Cache
    - Max Entries-Maximum number of entries allowed in the main cache
    - Activity Timeout-Activity timer value
    - Inactivity Timeout-Inactivity timer value
    - Size-Distribution of IP packets by size
    - Percent-Percent distribution of different-sized IP packets
  - Protocol - Port-Protocol of the sample and port destination for that sample
  - Total Flows-Total number of flows
  - Flows/Sec-Number of flows per second
  - Packets/Flow-Number of packets per flow
  - Bytes/Packet-Number of bytes per packet
  - Packets/Sec—Number of packets per second
  - Src. Addr—Source address of sampled packets
  - Src. Intf—Source interface of sampled packets
  - Dst. Addr—Destination address of sampled packets
  - Dst. Intf—Destination interface of sampled packets
  - Summary
    - Total Flows Processed—Total number of flows processed
    - Total Packets—Total number of packets sampled
    - Total Bytes—Total number of bytes received
- Example 1—Brief output

      host1#
      show ip cache flow active brief
      29140 packets sampled.
      Distribution of IP packets by size.
         Size         Percent
      ----------      -------
          1 - 32        0.000
              64        0.000
              96        0.000
             128        0.000
             160        0.000
             192        0.000
             224        0.000
             256        0.000
             288        0.000
             320        0.000
             352        0.000
             384        0.000
             416        0.000
             448        0.000
             480        0.000
             512        0.000
             544        0.000
             576        0.000
            1024       96.791
            1536        3.209
            2048        0.000
            2560        0.000
            3072        0.000
            3584        0.000
            4096        0.000
            4608        0.000

                      Total        Flows          Packets   Bytes       Packets
      Protocol-Port   Flows        /Sec           /Flow     /Packet     /Sec
      -------------  ---------    ---------    ----------  --------- ---------
      TCP–telnet       1          0.000           118.000   1014.000   0.000
      UDP–whois++      1          0.008           935.000   1026.000   7.664

      ------------------ Summary ---------------------
      Total Flows Processed: 2
      Total Packets 1053
      Total Bytes   1078962
      ------------------------------------------------

- Example 2—Detailed output

  | Note: The output format for this command was modified slightly to fit within the confines of this document.

      host1# show ip cache flow active detail
      Main Cache
      Max Entries: 65536
      Activity Timeout: 60 mins.
      Inactivity Timeout: 600 secs.
      Cache Enabled
      32012 packets sampled.
      Distribution of IP packets by size.
         Size         Percent
      ----------      -------
          1 - 32        0.000
              64        0.000
              96        0.000
             128        0.000
             160        0.000
             192        0.000
             224        0.000
             256        0.000
             288        0.000
             320        0.000
             352        0.000
             384        0.000
             416        0.000
             448        0.000
             480        0.000
             512        0.000
             544        0.000
             576        0.000
            1024       96.789
            1536        3.211
            2048        0.000
            2560        0.000
            3072        0.000
            3584        0.000
            4096        0.000
            4608        0.000

                                                                          Packets    Bytes      Packets
       Src.Addr        Src.Intf   Dst.Addr     Dst.Intf   Protocol Port   /Flow      /Packet    /Sec
      --------------- ---------- ------------ ---------- --------------- ---------- ---------- ---------
      10.20.30.41 258  GigE4/0    12.0.0.2      GigE2/0    TCP-telnet     58.000     1014.000   0.000
      10.20.30.41 63   GE4/0      50.60.70.88              UDP-whois++    1028.000   1026.000   7.672
      ------------------ Summary ---------------------
      Total Flows Processed: 2
      Total Packets 1086
      Total Bytes   1113540
      ------------------------------------------------

- Example 3—History output

      host1# show ip cache flow history
      35604 packets sampled.
      Distribution of IP packets by size.
         Size         Percent
      ----------      -------
          1 - 32        0.000
              64        0.000
              96        0.000
             128        0.000
             160        0.000
             192        0.000
             224        0.000
             256        0.000
             288        0.000
             320        0.000
             352        0.000
             384        0.000
             416        0.000
             448        0.000
             480        0.000
             512        0.000
             544        0.000
             576        0.000
            1024       96.784
            1536        3.216
            2048        0.000
            2560        0.000
            3072        0.000
            3584        0.000
            4096        0.000
            4608        0.000
                             Total         Flows     Packets      Bytes      Packets
         Protocol Port       Flows          /Sec       /Flow       /Pkt        /Sec
      -------------------  ----------  ---------  ------------  ---------  -----------
      TCP-telnet                  216      1.450       159.264   1014.000      230.879
      ------------------ Summary ---------------------
      Total Flows Processed: 216
      Total Packets 34401
      Total Bytes   34882614
      ------------------------------------------------

- See show ip cache flow.

show ip cache flow aggregation

- Use to display IP flow cache operational statistics for an aggregation cache.
- Field descriptions
  - Aggregation Cache
    - AS—AS aggregation cache
    - Destination-prefix—Destination-prefix aggregation cache
    - Prefix—Prefix aggregation cache
    - Protocol-port—Protocol-port aggregation cache
    - Source-prefix—Source-prefix aggregation cache
  - Total Flows—Total number of flows
  - Flows/Sec—Number of flows per second
  - Packets/Flow—Number of packets per flow
  - Bytes/Packet—Number of bytes per packet
  - Packets/Sec—Number of packets per second
  - Src. Addr—Source address of sampled packets
  - Src. Intf—Source interface of sampled packets
  - Dst. Addr—Destination address of sampled packets
  - Dst. Intf—Destination interface of sampled packets
  - Summary
    - Total Flows Processed—Total number of flows processed
    - Total Packets—Total number of packets sampled
    - Total Bytes—Total number of bytes received
- See show ip cache flow aggregation.

Example—Aggregation cache flow output

    host1#show ip cache flow aggregation as active brief
    29140 packets sampled.

                                   Total           Packets   Bytes       Packets
       Src.AS         Dst.AS       Flows           /Flow     /Pkt        /Sec
    -------------  - ---------    ----------     ---------  --------- ---------
    400              100           0.000           118.000   1014.000   0.000
    100              400           0.008           935.000   1026.000   7.664

    ------------------ Summary ---------------------
    Total Flows Processed: 2
    Total Packets 1053
    Total Bytes   1078962
    ------------------------------------------------

show ip flow export

- Use to display configuration values for IP flow cache export.
- Example

      host1#show ip flow export
      Flow export is enabled using version 5 format.
      Exporting to 10.0.0.2 port 9898 using source ip interface
      GigabitEthernet5/0/0.

- See show ip flow.

show ip flow sampling

- Use to display configuration values for IP flow cache sampling.
- Example

      host1#show ip flow sampling
      Flow sampling is enabled
      'Packet Interval' sampling mode is configured.
      1 out of every 1000 packets is being sampled.

- See show ip flow.