Install and run the Diagnostics CLI
The Diagnostics CLI can be installed and run with a single command on Linux and Windows. This installation method will download the Diagnostics CLI binary to the present working directory. The Diagnostics CLI automatically searches its root directory and subdirectories for agent configuration files and other relevant data.
Platform-specific manual installation procedures
To manually install and run the Diagnostics CLI, follow the procedures for your platform:
Suites flag (highly recommended CLI option)
A suite is a collection of health checks that target specific products or issues. Using a suite can help narrow the scope of troubleshooting and reduce the occurrence of false positives.
To review a list of available suites, run the Diagnostics CLI with the -help suites
option:
$./nrdiag -help suites
To run suites with nrdiag
, provide the -suites
flag and one or more suite names (for example, java
) to run as arguments.
Linux and macOS:
For 64-bit systems:
bash$./nrdiag_x64 -suites SUITE NAMESFor ARM64 systems:
bash$./nrdiag_arm64 -suites SUITE NAMES
Windows:
To run from PowerShell, add ./
to the start of cmd
.
For 32-bit systems:
bash$nrdiag.exe -suites SUITE NAMESFor 64-bit systems:
bash$nrdiag_x64.exe -suites SUITE NAMESFor ARM64 systems:
bash$nrdiag_arm64.exe -suites SUITE NAMES
Scripts
Scripts provide an additional datasource for information that isn't collected by a task. The catalog of available scripts can be found in the Diagnostic CLI's github repository.
Script output
Script output is printed to the screen and is saved in a file based on the name of the script (for example, name-of-script.out
). This is saved in the directory specified by -output-path
, defaulting to the current directory.
Scripts can also output files, either to the current working directory or the directory specified by -output-path
. All output files are included in the results zip in the ScriptOutput/
directory.
Script results
The results of running a script can be found in the nrdiag-output.json
file with the following schema:
"Script": { "Name": "example", "Description": "Example Description", "Output": "example output", "OutputFiles": [ "/path/to/example.out", "/path/to/another-file.out" ], "OutputTruncated": false}
The Output
field contains the stdout output. If it is over 20000 characters, it is truncated and the OutputTruncated
field is set to true
. Even if trucated, the full output is still available in the ScriptOutput/
directory in the zip file.
A list of files the script created can be found in the Outputfiles
field.
List, view, and run a script
Include additional files in the zip
If you have additional files that you would like to share with support, you can include them in the nrdiag-output.zip
file using the -include
command line flag. This can be used with a single file or a directory. If a directory is provided, all of its subdirectories are included. The total size limit of the files included is 4GB.
Use this in combination with -attach
to upload the files to your New Relic account.
Linux and macOS:
For 64-bit systems:
bash$./nrdiag_x64 -include /entire/directory/ -attachFor ARM64 systems:
bash$./nrdiag_arm64 -include /entire/directory/ -attach
Windows:
To run from PowerShell, add ./
to the start of cmd
.
For 32-bit systems:
bash$nrdiag.exe -include Path\To\File -attachFor 64-bit systems:
bash$nrdiag_x64.exe -include \Entire\Directory\ -attachFor ARM64 systems:
bash$nrdiag_arm64.exe -include \Entire\Directory\ -attach
Upload results to a New Relic account
重要
If your system is not configured to connect to external IP addresses, this method will not work. Instead, attach the output files in an email to New Relic Support.
Automatic account upload
To upload your results automatically to a New Relic account when the Diagnostics CLI is executed, use either the -attach
or -api-key
command line flags. The -attach
flag will validate any New Relic license keys found in your environment and upload the run to the account associated with the license key. Alternatively, the -api-key
flag will use the provided to upload the run, regardless of the presence of a valid license key.
Uploading your results to an account will automatically upload the contents of the nrdiag-output.json
and nrdiag-output.zip
.
Region Selection
By default, the Diagnostics CLI uploads results to New Relic accounts hosted in the US data center. If your account is hosted in the EU data center, ensure to add -region eu
to the command.
$./nrdiag -region eu ...