This article describes how to monitor cRPD memory by using the Command Line Interface (CLI) and the Junos Telemetry Interface (JTI) and how to monitor CPU by using CLI.
root@cRR1:/home/regress# docker stats --no-stream CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS 22833268f683 cRR1 0.06% 64.31MiB / 2GiB 3.14% 382MB / 41.9MB 11.6MB / 95.7MB 49
You can also use the CLI command show task memory detail on the container to monitor the memory of a container:
root@cRR1> show task memory detail Overall Memory Report Size TXP Allocs Mallocs AllocBytes MaxAllocs MaxBytes FreeBytes 8 4 - 32 212 2016 1984 16 571 - 9136 1042 65152 56016 24 926 - 22224 5237 244680 222456 32 26537 - 849184 28458 1110304 261120 40 5270 - 210800 7690 408400 197600 Dynamically allocated memory: 36259736 Maximum: 46854144 Program data+BSS memory: 20942848 Maximum: 20942848 Page data overhead: 1680 Maximum: 1680 Page directory size: 143104 Maximum: 143104 ---------- Total bytes in use: 57347368 (0% of available memory)
The JTI sensor corresponding to show task memory detail is /junos/task-memory-information. A sample output when JTI polling is done locally from the host is given below:
root@cRR1:~/bin# ls -ltr total 17584 -rwxr-xr-x 1 root root 18001001 May 23 21:13 jtimon-v1.31.0-dev -rwxr-xr-x 1 root root 191 May 23 21:16 sensor.json root@cRR1:~/bin# cat sensor.json { "host": "172.17.0.2", >> Management IP for the container/cRPD "grpc": { "ws": 1048576 }, "port": 50051, "paths": [ { "path": "/junos/task-memory-information", "freq": 10000 } ] } root@cRR1:~/bin# root@cRR1# show system services | display set set system services extension-service request-response grpc clear-text port 50051 set system services extension-service request-response grpc skip-authentication # ifconfig eth0 eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.17.0.2 netmask 255.255.0.0 broadcast 172.17.255.255 inet6 fe80::42:acff:fe11:2 prefixlen 64 scopeid 0x20<link> ether 02:42:ac:11:00:02 txqueuelen 0 (Ethernet) RX packets 1833107 bytes 794916472 (794.9 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 2047011 bytes 139409446 (139.4 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 root@cRR1:~/bin# ./jtimon-v1.31.0-dev --config sensor.json –print … 2022/05/23 21:17:04 key: tm-max-alloc-bytes 2022/05/23 21:17:04 uint_value: 224 2022/05/23 21:17:04 key: tm-function-calls 2022/05/23 21:17:04 uint_value: 9578546 2022/05/23 21:17:04 key: __prefix__ 2022/05/23 21:17:04 str_value: /junos/task-memory-information/task-memory-malloc-usage-report/task-malloc-list/task-malloc[tm-name='task']/ 2022/05/23 21:17:04 key: tm-allocs 2022/05/23 21:17:04 uint_value: 108 2022/05/23 21:17:04 key: tm-alloc-bytes 2022/05/23 21:17:04 uint_value: 3176 2022/05/23 21:17:04 key: tm-max-allocs 2022/05/23 21:17:04 uint_value: 108 2022/05/23 21:17:04 key: tm-max-alloc-bytes 2022/05/23 21:17:04 uint_value: 3176 2022/05/23 21:17:04 key: tm-function-calls 2022/05/23 21:17:04 uint_value: 148 2022/05/23 21:17:04 key: __prefix__ 2022/05/23 21:17:04 str_value: /junos/task-memory-information/task-memory-malloc-usage-report/task-malloc-list/task-malloc[tm-name='bit_vector']/ Collector Stats (Run time : 2.940094735s) 5 : in-packets 2072 : data points (KV pairs) 233 : in-header wirelength (bytes) 79478 : in-payload length (bytes) 79478 : in-payload wirelength (bytes) 39739 : throughput (bytes per seconds)
Additionally, the same JTI sensor can be polled remotely. You need to open and map the port on the container and the host. Use the following command to open and map the host port to the container port while spinning up the container.
docker run --rm -detach --name cRR1 -h cRR1 --privileged -v cRR1-config:/config -v cRR1Log:/var/log -p 50051:50051 --memory="1g" -it crpd:20.3X75-D5.5
In the above command, - port 50051 on the container (on the right of ":") is mapped to port 50051 on the docker host (on the left of ":").
set system services extension-service request-response grpc clear-text port 50051 set system services extension-service request-response grpc skip-authentication { "host": "10.49.165.49", >> Host Management IP "grpc": { "ws": 1048576 }, "port": 50051, "paths": [ { "path": "/junos/task-memory-information", "freq": 10000 } ] } root@rpt-set-jvision-lnx01:/home/test/gtc# ./jtimon0712 --config rcpd.json --print 2022/05/24 13:20:56 Processing json config 2022/05/24 13:20:56 Host: 10.49.165.49 2022/05/24 13:20:56 Port: 50051 2022/05/24 13:20:56 CID: 2022/05/24 13:20:56 API-Port: 0 2022/05/24 13:20:56 gRPC window-size: 1048576 2022/05/24 13:20:56 Path: /junos/task-memory-information Freq: 10000 2022/05/24 13:20:56 Headers: 2022/05/24 13:20:56 init-response: [response { subscription_id: 1 } path_list { path: "/junos/task-memory-information/" sample_frequency: 10000 } ] 2022/05/24 13:20:56 grpc-accept-encoding: [identity,deflate,gzip] 2022/05/24 13:20:56 accept-encoding: [identity,gzip] 2022/05/24 13:20:56 2022/05/24 13:20:58 system_id: cRR1 2022/05/24 13:20:58 component_id: 65535 2022/05/24 13:20:58 sub_component_id: 0 2022/05/24 13:20:58 path: sensor_1000:/junos/task-memory-information/:/junos/task-memory-information/:xmlproxyd 2022/05/24 13:20:58 sequence_number: 0 2022/05/24 13:20:58 timestamp: 1653378674161 2022/05/24 13:20:58 key: __timestamp__ 2022/05/24 13:20:58 uint_value: 1653378674162 2022/05/24 13:20:58 key: __junos_re_stream_creation_timestamp__ 2022/05/24 13:20:58 uint_value: 1653378674114 2022/05/24 13:20:58 key: __junos_re_payload_get_timestamp__ 2022/05/24 13:20:58 uint_value: 1653378674155 2022/05/24 13:20:58 key: __prefix__ 2022/05/24 13:20:58 str_value: /junos/task-memory-information/task-memory-overall-report/task-size-block-list/task-size-block[tsb-size='8']/ 2022/05/24 13:20:58 key: tsb-alloc-bytes 2022/05/24 13:20:58 uint_value: 136 2022/05/24 13:20:58 key: tsb-allocs 2022/05/24 13:20:58 uint_value: 17 2022/05/24 13:20:58 key: tsb-max-allocs 2022/05/24 13:20:58 uint_value: 121 2022/05/24 13:20:58 key: tsb-max-bytes 2022/05/24 13:20:58 uint_value: 2016 2022/05/24 13:20:58 key: tsb-free-bytes 2022/05/24 13:20:58 uint_value: 1880 2022/05/24 13:20:58 key: __prefix__
As of today, cRPD does not support the cli>show system processes extensive command on Junos OS, hence no CPU stats will be available from the CLI client. Alternatively, you can use /usr/bin/top to get the CPU stats in cRPD.
root@cRR1:/home/regress# /usr/bin/top top - 19:57:10 up 6 days, 18:57, 1 user, load average: 0.00, 0.00, 0.00 Tasks: 222 total, 1 running, 174 sleeping, 0 stopped, 1 zombie %Cpu(s): 0.2 us, 0.1 sy, 0.0 ni, 99.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 32940376 total, 31007916 free, 645160 used, 1287300 buff/cache KiB Swap: 946984 total, 946404 free, 580 used. 31868772 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 24974 root 20 0 44212 3960 3200 R 0.7 0.0 0:00.07 top 22119 root 20 0 960196 98268 33672 S 0.3 0.3 0:56.94 rpd
Since no CLI command is available to check the CPU on cRPD, there is no corresponding JTI sensor support for monitoring the CPU via JTI.
2022-06-07: Version 1