Enhanced Debugging

Monitoring Resource Status

The target system should be examined for resource bottlenecks, which can cause excessively long scan durations - particularly CPU constraints - that result in scans being aborted due to the "Max. Runtime" setting. The System Load dashboard in the AMC provides a good starting point for this analysis. If resource bottlenecks are identified, you should either adjust the asset's resources or reduce THOR's resource consumption, though the latter should be considered only as a last resort.

image-20260115-100757.png
System Load of an asset displayed in ASGARD Management Center

Analyzing Restarts and Shutdowns

Special attention should be given to scan aborts caused by system restarts or shutdowns of the asset or agent.

An orderly restart during a scan is documented by the agent as follows:

2025/02/12 14:24:34 ASGARD_GENERIC: Info: {"level":"INFO","time":"2025-02-12T14:24:34+01:00","message":"received interrupt signal, sending interrupt signal to subprocess...","component":"controller","pid":8920,"path":"C:\\WINDOWS\\System32\\asgard2-agent\\bin\\generic.exe"}

2025/02/12 14:24:34 ASGARD_GENERIC: Info: {"level":"INFO","time":"2025-02-12T14:24:34+01:00","message":"waiting for graceful process stop...","component":"runner","pid":5420,"path":"C:\\WINDOWS\\Temp\\asgard2-agent\\a3fb09b3-3169-465b-b78a-0b98a3aa7f4f\\thor\\thor64.exe","timeout":"45s"}

A disorderly restart does not give the agent time to create an entry. 

If the AMC-controlled resume upper limit or the scan deadline has been reached, the scan will not be republished to the asset. The following status text in the AMC dashboard indicates this error:

failed to send start task request: rpc error: code = Unknown desc = task has already been started and cannot be resumed anymore (max resumes: 5, deadline: 2025-01-20T06:53:13Z)

To analyze a restart in the operating system events, we can use a playbook in AMC. The example below demonstrates using wevutil for MS Windows.

image-20260114-113708.png
A playbook configured to fetch Windows System Logs in AMC

Using Syslog

Since the THOR log is not uploaded if the scan fails, using Syslog provides access to the logs despite this.

Enable the syslog flag during scan setup to send logs to your AMC.

image-20260115-104149.png
Scan settings in AMC configured to receive syslog

Once the scan has failed, you can access the logs through the Logs interface within your AMC. For example, this allows you to review the THOR modules that were in use just before the scan completion.

image-20260115-104528.png
Syslog entries in the THOR scan logs

Debugging with THOR Util (Playbook Example)

Preparation

If the error remains unidentified, THOR Util can help to pinpoint the problem. Running THOR util with the diagnostics flag will create a detailed diagnostics log which can be uploaded to AMC. However, using it requires a few preparatory steps. We will provide a step-by-step guide in the text section.

THOR Util

THOR Util is not included in the AMC THOR package and must be downloaded separately from the Customer Portal or requested directly from Nextron Systems.

THOR Binary

THOR Util requires both a previous scan and the THOR binary, meaning the scan cannot be executed via the agent and must be part of the playbook itself. You can download the THOR package from "Downloads / THOR" in your AMC and retrieve the license using the "asgard" flag. Downloading the THOR license during playbook execution requires the Download Token from your AMC, found under "Downloads/THOR", which can be integrated directly into your playbook or defined as a variable.

​CA Certificate

For secure communication with the AMC (such as retrieving the license key), the root CA certificate for host verification during TLS handshakes must be accessible and added to your playbook. The root CA can be downloaded from https://YOUR-AMC:8443/ca.pem.

​Using Same Flags

To accurately diagnose the issue, you must use exactly the same flags as the failed scan. These flags can be entered when assigning the playbook task to your asset.

Proceed as follows to setup your playbook.

Playbook Setup

This example is based on Windows OS but can be adapted for Linux or macOS. Ensure you select the correct packages for your target operating system. Your package names may differ from the provided example, and it is helpful to include the software and OS version in the THOR and THOR Util package filenames.

  1. Download the THOR package, the ca certificate and THOR Util on your computer.

  2. Upload these files to your AMC via "Response Control / Playbook Files".

  3. Create a new Playbook "Debug Scan (Windows).

In this Playbook, create the following steps:

Step

Playbook action

Comment

1

The following file will be downloaded from the ASGARD Management Center:
thorutil-1-11-win.zip
The file will be unzipped

 

2

The following file will be downloaded from the ASGARD Management Center:
thor-10-7-win.zip
The file will be unzipped

 

3

The following file will be downloaded from the ASGARD Management Center:
ca.pem

 

4

The following command(s) will be executed:
xcopy * c:\windows\temp\thor-diagnostics /h /i /c /k /e /r /y

For execution a temp folder will be created.

5

The following command(s) will be executed:
c:\windows\temp\thor-diagnostics\thor64.exe $scan_flags$ --asgard nextron-amc-testing.goetz --asgard-token YOUR DOWNLOAD TOKEN --ca ca.pem -e c:\windows\temp\thor-diagnostics

The required scan flags will be defined as variables and defined when the task is executed. Please replace "YOUR DOWNLOAD TOKEN" with your own.

6

The following command(s) will be executed:
c:\windows\temp\thor-diagnostics\thor-util.exe diagnostics --run --output c:\windows\temp\thor-diagnostics\thor-diagnostics.zip

THOR Util will be executed with "diganostics" flag. The diagnostics package will be stored as ZIP package in the working folder.

7

The following path will be collected:
c:\windows\temp\thor-diagnostics\thor-diagnostics.zip

thor-diagnostics.zip will be uploaded to your AMC.

8

The following command(s) will be executed:
rmdir /q /s c:\windows\temp\thor-diagnostics

Delete the working directory.

image-20260115-135152.png
The created playbook with all necessary steps

Please do not forget to reinsert the flags that were used in the faulty scan.

image-20260115-135230.png
Flags added to the “Run Playbook” task