Remediating disk issue with a chatbot
Last updated
Last updated
To help you get started, review the following NQL examples for typical chatbot use cases.
To provide employees with basic troubleshooting related to their device issues, leverage Nexthink data about employee devices to retrieve basic device information and launch a remediation to fix a disk issue.
Before you start, integrate your chatbot with Nexthink, ensure that you have the following in place:
Nexthink license
Administrator permissions
Design standardized steps for the employees-chatbot interaction and define the API technologies to use in each step. The following table illustrates the interaction steps for this example.
Interaction stage | API technology |
---|---|
The selection of technology will hinge on how you currently utilize Nexthink features and the limits available in your license. Refer to Nexthink Infinity thresholds and limits overviewdocumentation page for more information, including API limits.
Configure API features in the Nexthink web interface. Nexthink recommends following the sequence in which the features are listed, as some are interdependent. Nonetheless, you have the flexibility to navigate between different solutions according to your preference.
Install the following remote actions from Nexthink Library:
Get Startup Impact
Get Battery Status
Schedule the executions to occur daily. Refer to Managing remote actions for more information
When you complete this step, save the NQL ID of both remote actions to use in the next steps.
NQL ID's:
get_startup_impact_windows
get_battery_status
Install the Disk Cleanup remote action from Nexthink Library. If already Installed, copy it and configure it as follows:
Select API for the remote action trigger.
Set default input parameter values that are in line with your chatbot needs. See the Input parameters for Disk Cleanup remote action table below.
When you complete this step, save the remote action's NQL ID for use in the next steps.
NQL ID: disk_cleanup
According to the designed scenario, you need to create three NQL API queries:
Get user devices based on the username
of the user (Stage 1: Identifying device).
Get device data to perform diagnostics for the current topic (Stage 2: Diagnosing device).
Get the remote action status and results (Stage 4: Following up on the fix).
See details of each NQL API query.
When you complete this step, save the NQL ID's of all NQL API queries to use them in the next steps.
NQL ID's:
#get_device_basic_infos
#diagnose_device_bad_health
#get_remote_action_result
Create API credentials in the Nexthink web interface to establish secure communication between Nexthink and the chatbot. Select Remote Actions API and NQL API in the Permissions section. Refer to API credentials for more information.
When you complete this step, save the Client ID and Client Secret obtained during the credential creation in the Nexthink web interface.
Once you configured all necessary API features within Nexthink, you can move on to implementing the API calls within the chatbot's service layer. The following steps reflect the user-chatbot interaction design.
Prior to executing the following API calls, you first need to retrieve a valid authentication token. Refer to the Nexthink Nexthink Developer documentation on how to obtain a valid OAuth token using your generated API credentials.
Employee (user) “I have an issue with my device”
To identify the device, Use the #get_device_basic_infos
NQL API query that you created previously (See: Get user devices based on the username of the user).
(Chatbot) “I have found the following devices for you, which one are you having issues with?”
(1) Laptop XN1231242-2142 (Lenovo)
(2) Laptop XCX124231-1231 (Apple)
Employee (user) “1”
To get device information, use the #diagnose_device_bad_health
NQL API query that you created previously (See: Get device data to perform diagnostics for the current topic).
Input from the previous step
You retrieved the device name in Step 2: Identifying device.
(Chatbot) ”Thanks, I see that your device has only about 2 GB of free disk space left.”
“I can clean up unneeded files to prevent slowdowns.”
“Do you want me to proceed?”
Employee (user) “Yes”
Use Remote Action API to execute Disk Cleanup remote action that you configured in the previous step and remedy the problem (See: Configuring remediation remote actions).
Input from the previous step
You retrieved the collector.uid
in Step 3: Diagnosing device via the #diagnose_device_bad_health
NQL API (or a data export).
(Chatbot) “I have launched the fix. It should only take a short while.”
Use the #get_remote_action_result
NQL API query that you created previously to get the remote action status and results.
(See: Get the remote action status and results).
Nexthink recommends making a call to get the remote action results no earlier than 1 minute after triggering the remote action with the API.
Input from the previous step
You retrieved the request_id
in Step 4: Remediating the issue via the Remote action API call.
Display the remote action status
and output
retrieved in this step.
(Chatbot) “I am all done - I freed up 1.3 GB. Is there anything else I can do to help you?”
If your company has purchased the Nexthink Flow, you can configure a workflow that performs all the diagnostics and remediations described in the previous section, fully orchestrating the process within the workflow, without having to program the logic within the chatbot or other third-party solutions.
Use the Connector and Service API thinklets, to call API and provide real-time feedback.
Use the API listener thinklet to wait until a given third-party API resumes.
Trigger a workflow with the Flow API.
Refer to the Workflows documentation page for more information.
To help you get started with chatbot integration, find examples of topics that you can use in typical chatbot conversations. Each topic includes:
Prerequisite data collection remote actions. All remote actions referred to in this section are available in Nexthink Library and you must configure them beforehand:
The data collection remote action must have the trigger type Schedule active and a collection schedule set to hourly or daily, depending on the required frequency.
The remediation remote action must have the trigger type API active. Refer to the Manage Remote Actions documentation for more information.
A Diagnostic NQL query.
Logic on how to interpret the diagnostics query results.
Possible remediations for each diagnostic.
You can implement the examples using a similar flow to the end-to-end use case, assuming that you have identified the device name beforehand.
As shown in the end-to-end use case, you need to configure generic queries in order to perform two basic tasks that can be useful across all use cases:
Diagnose issues that cause Microsoft Outlook to malfunction for an employee.
Diagnose issues related to Microsoft OneDrive and repair OneDrive when the system detects issues.
Diagnose a wide range of typical issues resulting in slowness on the endpoint.
RELATED TOPIC
Input | Recommended value |
---|---|
Task | NQL queries |
---|---|
Type | Content |
---|---|
Type | Content |
---|---|
Type | Content |
---|---|
Step 1: Authenticating communication
Configure API credentials and Collect a token via the API.
Step 2: Identifying the device
Use NQL API to allow the chatbot to identify the devices based on the username
. Alternatively, use the Data Exporter.
Step 3: Diagnosing device
Use NQL API (or Data Exporter) to retrieve device performance data and outputs of the Get Startup Impact and Get Battery Status remote actions.
Step 4: Remediating the issue
Use Remote Action API to trigger the Disk Cleanup remote action on a users' device.
Step 5: Following up on the fix
Use NQL API to get the remediation status and details and inform the user about the remediation results.
DiskCleanupCampaignId
If you want to display a campaign, use the library campaign disk_cleanup_invoke
.
If you don’t want a campaign confirmation pop-up to appear, enter value 00000000-0000-0000-0000-000000000000
CleanupCompletedCampaignId
If you want to display a campaign, use the library campaign disk_cleanup_completed
.
If you don’t want a campaign notification pop-up to appear, enter value 00000000-0000-0000-0000-000000000000
RemoveFilesNotModifiedInDays
Default value from Library (7)
MaximumDelayInSeconds
Default value from Library (30)
CleanupLevel
Choose the cleanup level, Light or Deep.
This field works only if you decide not to use a campaign and involve the employee in choosing the cleanup level. Otherwise, an employee’s choice takes precedence.
Retrieve device of a user
Query ID: #get_device_basic_infos - matching based on the username
You can adjust the where clause | where user.name == $username
for use with alternative approaches, for example:
If you know the user UPN: | where user.upn == $upn
(requires the UPN to be activated at collector level)
If you know the user email address: | where user.ad.email_address == $email
(requires the Azure AD connector to be activated and the email field synced)
If you know the device name: | where device.name == $device_name
Adjust the timeframe if you want to consider devices on which the user has been active during a period of time other than 7 days.
Replace both past 7d
clauses with the desired timeframe, up to the maximum data retention period in your Nexthink tenant, which is by default 30 days.
Retrieve the status and outputs of remediation remote actions
Query ID: #get_remote_action_result
Platforms
Microsoft Windows
Data collection remote actions
Schedule data collection remote actions:
Get Microsoft Outlook online
Get Microsoft Outlook plugin crash details
NQL query
Query ID: #diagnose_outlook_issues
Remediation list
IF remote_action.get_outlook_online_windows.execution.outputs.IsOnline
= "No"
and remote_action.get_outlook_online_windows.execution.status
= "success"
THEN Run remediation remote action Set Outlook online
IF remote_action.get_outlook_plugin_crash_details_windows.execution.outputs.CrashedPluginList
!= "["-"]"
THEN Run remediation remote action Set Outlook plugins
IF device.boot.days_since_last_full_boot
> 10
THEN Recommend the employee restart their machine.
IF outdated_office_packages
= "1"
THEN Run remediation remote action Repair Office 365
Additional generic remediation: Run remediation remote action Repair Outlook OST Problem
Platforms
Microsoft Windows
Data collection remote action
Schedule data collection remote actions:
Get OneDrive status
NQL query
Query ID: #diagnose_onedrive_issues
Remediation list
IF remote_action.get_onedrive_status.execution.outputs.OneDriveStatus
contains one of the following:
OneDrive is not installed
OneDrive is installed but not running
OneDrive environment variable does not exist
OneDrive folder is not present
THEN Run remediation remote action Repair OneDrive
Platforms
Microsoft Windows
Data collection remote actions
Schedule data collection remote actions:
Get GPO startup impact
Get startup impact
NQL query
Query ID: #diagnose_slow_pc_issues
Remediation list
IF device.boot.days_since_last_full_boot
> 10
THEN Recommend the employee restart their machine.
IF free_space_GB
<= 6
THEN Run remediation remote action Disk cleanup
IF remote_action.get_startup_impact_windows.execution.outputs.HighImpactCount
> 0
THEN Run remediation remote action Disable Application from Startup menu using the value of remote_action.get_startup_impact_windows.execution.outputs.HighImpactApplications
to disable high-impact applications
IF remote_action.get_gpo_startup_impact_windows.execution.outputs.UserGpoAppliedTimeInSeconds
+ remote_action.get_gpo_startup_impact_windows.execution.outputs.UserGpoDCDiscoveryInSeconds
> 10
THEN Run remediation remote action Update Group Policy settings
IF outdated_office_packages
= "1"
THEN Run remediation remote action Repair Office 365