> For the complete documentation index, see [llms.txt](https://jncia-workbook.gitbook.io/workbook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jncia-workbook.gitbook.io/workbook/junos-basics/25-live-monitoring-of-traffic.md).

# 25) Live Monitoring of Traffic

### Pre-Work

If you made any changes, you can quickly revert the lab using the **load\_config\_on\_nodes.py** script.

```
python3 load_config_on_nodes.py --lab_dir three-routers --config_filename basic.addressing.cfg
```

### Lab

Connect to R1, and run an extended ping to R2:

```
ping 10.1.2.2 rapid count 100000
```

* `ctrl+C` will cancel this ping if needed

On R2, use a command that shows live traffic stats on all interfaces.

Next, on R2, use a command that shows live detailed statistics for just `ge-0/0/0`.

### Answer

<details>

<summary>Expand to reveal</summary>

The command `monitor interface traffic` will show live traffic stats for all interfaces, with one line per interface.

<figure><img src="/files/wNFkOUhztNT1qoPxU1ik" alt=""><figcaption></figcaption></figure>

\
To get live detailed stats for just the `ge-0/0/0` interface, we use `monitor interface ge-0/0/0`.

<figure><img src="/files/SaYAWR73LMT8S8PQEDbo" alt=""><figcaption></figcaption></figure>

</details>

### Explanation

<details>

<summary>Expand to reveal</summary>

The `monitor` command gives you output that refreshes on an interval, I believe every two seconds. This is similar to the `watch` command in linux. Also note that you can achieve something similar by piping a regular show command to `| refresh <seconds>`.

\
In this lab we use `monitor interface traffic` to get an output of packet counts and pps value for each interface. This can be used to get a real-time feel for the traffic flow through the router.

\
The second command we use is `monitor interface ge-0/0/0` to get detailed stats of the interface. I believe on a physical platform we would see even more statistics.

\
You use `ctrl+C` to exit these.

</details>

### Further Reading

<https://www.juniper.net/documentation/us/en/software/junos/cli-reference/topics/ref/command/monitor-interface.html>

<https://www.juniper.net/documentation/us/en/software/junos/network-mgmt/topics/topic-map/monitoring-and-troubleshooting-resources.html>

<https://blog.marquis.co/posts/2015-05-26-jncia-refresher-3-operational-monitoring-and-maintenance/#monitor-commandsreal-time-performance-monitoring-rpm>
