Call does not wait for script execution to finish
DgoNascimento opened this issue · 5 comments
Hello guys,
I would like some help.
I'm using script_exporter to run a shell script, which runs another powershell script.
Executing the shell script, I have the return successfully, even though the return is not immediate, taking 30s for example.
Even though I configure the scrap time and the timeout time, whenever I execute the curl call from the exporter, the return is immediate and with that it does not return the echo (variable created with the expected value).
Would you have any idea why?
Would it be because of the shell script to run another power shell?
Thank you very much!
@ricoberger could you support?
HI @DgoNascimento, I'm not quite sure what the problem could be. Maybe you can use the following two examples to test if this is timeout related:
scripts:
- name: showtimeout
script: sh /bin/examples/showtimeout.sh
timeout:
max_timeout: 60
- name: sleep
script: sleep 120
timeout:
enforced: true
It is also possible that the script doesn't wait for the execution of your other powershell script. Maybe sth. in this direction could help here: https://stackoverflow.com/questions/1741490/how-to-tell-powershell-to-wait-for-each-command-to-end-before-starting-the-next
Hi @ricoberger Thanks for the feedback.
Behavior is strange:
shell script execution:
time ./check_replicationFIN.sh
asr_replication_vm{} 13
real 0m23.734s
user 0m6.029s
sys 0m1.524s
exporter script execution:
curl http://127.0.0.1:9469/probe?script=check_replicationFIN
HELP script_success Script exit status (0 = error, 1 = success).
TYPE script_success gauge
script_success{script="check_replicationFIN"} 1
HELP script_duration_seconds Script execution time, in seconds.
TYPE script_duration_seconds gauge
script_duration_seconds{script="check_replicationFIN"} 0.636534
I performed a test with telegraf, and I had the error below. I don't know if you know or if you can help with anything:
Sep 06 16:27:50 powershell[8605]: (7.2.6:1:80) [Perftrack_ConsoleStartupStart:PowershellConsoleStartup.WinStart.Informational] PowerShell console is starting up
Sep 06 16:27:50 powershell[8605]: (7.2.6:A:80) [NamedPipeIPC_ServerListenerStarted:NamedPipe.Open.Informational] PowerShell has started an IPC listening thread on process: 8605 in AppDomain: None.
Sep 06 16:27:50 powershell[8605]: (7.2.6:1:80) [Perftrack_ConsoleStartupStop:PowershellConsoleStartup.WinStop.Informational] PowerShell console is ready for user input
Sep 06 16:27:50 powershell[8605]: (7.2.6:A:80) [NamedPipeIPC_ServerListenerError:NamedPipe.Exception.Error] An error has occurred in PowerShell IPC listening thread on process: 8605 in AppDomain: None. Error Message: Operation canceled.
Thank you in advance
Hi @DgoNascimento, since it looks like the script runs successfully script_success{script="check_replicationFIN"} 1
and my PowerShell knowledge is very limited I'm not quite sure how I can help here.