NetXMS Support Forum

English Support => General Support => Topic started by: MarcusH on October 10, 2016, 11:05:29 AM

Title: ExternalParameterShellExec runs multiple times
Post by: MarcusH on October 10, 2016, 11:05:29 AM
Hi,

I have set up one node to run a file via ExternalParameterShellExec on the agent but when it executes the file it runs it 3 times, any known related problems to this?
Searched the bugtracker but could not find any.

Tested both forced DCI poll and scheduled.

Agent version 2.0.5
Windows 2012 R2
Title: Re: ExternalParameterShellExec runs multiple times
Post by: Alex Kirhenshtein on October 10, 2016, 11:32:38 AM
Please increase debug level to 5, reproduce problem and send us agent log
Title: Re: ExternalParameterShellExec runs multiple times
Post by: MarcusH on October 10, 2016, 12:05:51 PM
This is not the real file, i tested different scenarios and this test.exe is only a while loop so it stays active

[10-Oct-2016 11:01:16.251] [DEBUG] [session:0] Requesting parameter "test"
[10-Oct-2016 11:01:16.251] [DEBUG] H_ExternalParameter called for "test" "Sc:\test.exe"
[10-Oct-2016 11:01:16.251] [DEBUG] RunExternal called for "test" "Sc:\test.exe"
[10-Oct-2016 11:01:16.251] [DEBUG] RunExternal: command line is "c:\test.exe"
[10-Oct-2016 11:01:16.251] [DEBUG] RunExternal (shell exec): worker thread created
[10-Oct-2016 11:01:18.266] [DEBUG] RunExternal (shell exec): execution timeout
[10-Oct-2016 11:01:18.266] [DEBUG] RunExternal (shell exec): execution status 2
[10-Oct-2016 11:01:18.266] [DEBUG] [session:0] Requesting parameter "test"
[10-Oct-2016 11:01:18.266] [DEBUG] H_ExternalParameter called for "test" "Sc:\test.exe"
[10-Oct-2016 11:01:18.266] [DEBUG] RunExternal called for "test" "Sc:\test.exe"
[10-Oct-2016 11:01:18.266] [DEBUG] RunExternal: command line is "c:\test.exe"
[10-Oct-2016 11:01:18.266] [DEBUG] RunExternal (shell exec): worker thread created
[10-Oct-2016 11:01:20.266] [DEBUG] RunExternal (shell exec): execution timeout
[10-Oct-2016 11:01:20.266] [DEBUG] RunExternal (shell exec): execution status 2
[10-Oct-2016 11:01:20.266] [DEBUG] [session:0] Requesting parameter "test"
[10-Oct-2016 11:01:20.266] [DEBUG] H_ExternalParameter called for "test" "Sc:\test.exe"
[10-Oct-2016 11:01:20.266] [DEBUG] RunExternal called for "test" "Sc:\test.exe"
[10-Oct-2016 11:01:20.266] [DEBUG] RunExternal: command line is "c:\test.exe"
[10-Oct-2016 11:01:20.266] [DEBUG] RunExternal (shell exec): worker thread created
[10-Oct-2016 11:01:22.282] [DEBUG] RunExternal (shell exec): execution timeout
[10-Oct-2016 11:01:22.282] [DEBUG] RunExternal (shell exec): execution status 2
Title: Re: ExternalParameterShellExec runs multiple times
Post by: Alex Kirhenshtein on October 10, 2016, 03:04:54 PM
Well, it behaves as expected.
If you need to handle long-running command - use ExternalParameterProvider (https://wiki.netxms.org/wiki/ExternalParametersProvider)
Title: Re: ExternalParameterShellExec runs multiple times
Post by: MarcusH on October 10, 2016, 05:34:18 PM
That seems logical, though this external does not return data by itself it consolidates data in an external sql db for faster queries.
Can run it in windows schedule but felt more right to run it from the agent that uses it on set schedule.

The answer though solved a few other data collection dilemmas i had so thanks for that, time to rethink my data providers :)
Title: Re: ExternalParameterShellExec runs multiple times
Post by: Alex Kirhenshtein on October 10, 2016, 08:36:44 PM
Problem with slow external parameters is that server retrieve values in a single thread (per agent) and it can block data collection from the agent