Introduction
This document describes the process to gather information from the NCS 1000 series including the NCS1001, NCS1002, NCS1004, and NCS1010.
Prerequisites
Requirements
There are no specific requirements for this document.
Components Used
This document is not restricted to specific software and hardware versions.
The information in this document was created from the devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If your network is live, ensure that you understand the potential impact of any command.
Background
The NCS1001, NCS1002, and NCS1004 have multiple contexts to gather logs and files. The graphic describes how to navigate between these contexts. The NCS1010 has only the run (XR Linux shell) as it runs XR7. Capturing information from a context other than XR requires you copy files between different locations.
NCS1K Command Line Contexts
Log Command Outputs
PuTTY
Capture session output under Session > Logging.
PuTTY command logging
SecureCRT
Select File > Log Session to save the CLI outputs.
Save Commands Locally
To save the output of a command with a large amount of information directly to the NCS1K, pipe the output to a file.
Note: Debug commands with verbose output can quickly fill the device storage when piped to a file.
RP/0/RP0/CPU0:NCS1002_1# show inventory | file harddisk:/inventory.txt
Wed Aug 30 15:35:51.322 UTC
[OK]
Confirm the file saved to harddisk.
RP/0/RP0/CPU0:NCS1002_1# dir harddisk:/inventory.txt
Wed Aug 30 15:37:29.941 UTC
Directory of harddisk:
48 -rwxr--r--. 1 1128 Aug 30 15:35 inventory.txt
Capture Show Techs
A show tech-support command gathers the output of many commands and collects them in one or more files, typically in harddisk:/showtech. The specific show tech command required depends on the current issue. The admin context has a separate set of show tech commands
RP/0/RP0/CPU0:NCS1002_1# show tech ncs1k detail
Wed Aug 30 16:23:20.995 UTC
++ Show tech start time: 2023-Aug-30.162321.UTC ++
Wed Aug 30 16:23:24 UTC 2023 Waiting for gathering to complete
...........................................................................................................................................................................................................................
Wed Aug 30 16:35:30 UTC 2023 Compressing show tech output
Show tech output available at 0/RP0/CPU0 : /harddisk:/showtech/showtech-NCS1002_1-ncs1k-2023-Aug-30.162321.UTC.tgz
++ Show tech end time: 2023-Aug-30.163534.UTC ++
Collect Files in Linux Shell
The contents of the /var/log directory contains a large number of files useful for diagnosing a wide variety of issues. To collect all of these files, use the tar command. This example uses the sysadmin context of the NCS1002.
First, move to the root directory and confirm /misc/disk1 has sufficient free space to store the tar file.
[sysadmin-vm:0_RP0:~]$ cd /
[sysadmin-vm:0_RP0:/]$ df -a
...
/dev/mapper/panini_vol_grp-ssd_disk1_calvados_1 3997376 172592 3598688 5% /misc/disk1
/dev/mapper/panini_vol_grp-ssd_disk1_calvados_swtam_1 47472 264 43484 1% /misc/swtam
/dev/loop1 1015700 197972 748916 21% /var/log
/dev/loop2 469636 4500 430020 2% /misc/config
/dev/loop3 1020456 1804 948768 1% /misc/scratch
none 512 0 512 0% /mnt
debugfs 0 0 0 - /sys/kernel/debug
/dev/loop4 3860988 1720220 1924924 48% /install_repo
tmpfs 10240 0 10240 0% /media/install_tmpfs
Compress the contents of the /var/log folder and verify the new file exists.
[sysadmin-vm:0_RP0:/]$ tar -czf /misc/disk1/admin_var_logs.tgz /var/log
[sysadmin-vm:0_RP0:/]$ ls -lrt /misc/disk1
Copy the file to the XR context to allow transfer to another location.
Transfer Files
Copy Files Between Contexts
Only the XR context connects to an external server, so all files must be present there before copying off of the device.
Copy from Admin to XR
sysadmin-vm:0_RP0# dir harddisk:/showtech/
sysadmin-vm:0_RP0# copy harddisk:/showtech/admin_var_logs.tgz harddisk:/showtech location 0/RP0/CPU0/VM1
Copy from Sysadmin to XR
[sysadmin-vm:0_RP0:/]$ scp /misc/disk1/showtech/admin_var_logs.tgz root@10.11.12.14:/harddisk:/showtech
admin_var_logs.tgz
The sysadmin /misc/disk1 location is equivalent to the admin harddisk: location. Likewise, files saved to xr-vm /misc/disk1 appear in the XR harddisk: location. All NCS 1000 devices use this convention.
Copy from Host to Admin
[sysadmin-vm:0_RP0:~]$ scp root@10.0.2.16:/host_var_logs.tgz /misc/disk1/showtech
Copy Files to an External Location
The NCS 1000 supports several different file transfer methods. This example uses File Transfer Protocol (FTP) to copy a file from harddisk to an external FTP server.
RP/0/RP0/CPU0:NCS1002_1# copy harddisk:/showtech/admin_var_logs.tgz ftp://root@[ ip_address ]:/
Wed Aug 30 13:52:30.655 CDT
Destination password:
Destination filename admin_var_logs.tgz?
Writing ftp://root:*@ip_address:/admin_var_logs.tgz
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
23862281 bytes copied in 8 sec ( 2982785)bytes/sec
Copy operation success
This example initiates the copy using Secure Copy Protocol (SCP) on an Ubuntu server.
admin@ubuntu:~$ sudo scp root@[ ip_address ]:/harddisk:/showtech/admin_var_logs.tgz ./
(root@ip_address) Password:
admin_var_logs.tgz
100% 1191 743.0KB/s 00:00
Copy Files to USB
When you insert a USB drive into a device supporting USB auto-mount, the system labels the drive as disk2. Use the copy command to transfer files from the harddisk to USB.
Clean Up Files
To save space on device storage, remove the show techs and log files after confirming a successful transfer to external storage.
RP/0/RP0/CPU0:NCS1002_1# delete harddisk:/showtech/admin_var_logs.tar.gz
Wed Aug 30 19:37:41.739 UTC
Delete harddisk:/showtech/host_var_logs_host.tar.gz[confirm]
To remove all show tech files, use the wildcard *.tgz.
RP/0/RP0/CPU0:NCS1002_1# delete harddisk:/showtech/*.tgz
Wed Aug 30 19:39:16.864 UTC
Delete harddisk:/showtech/*.tgz[confirm]
Use rm to remove files from the Linux shell.
[sysadmin-vm:0_RP0:/]$ rm -v /misc/disk1/admin_var_logs.tar.gz
removed '/misc/disk1/admin_var_logs.tar.gz'
Related Information