From d5dac1d3a3c09502ed92a1e5132b7f64e9ec46d8 Mon Sep 17 00:00:00 2001 From: spinto77 <75783970+spinto77@users.noreply.github.com> Date: Mon, 18 Oct 2021 10:51:53 +0100 Subject: [PATCH] Fix linux engines url Discovery on HSBC 04 and HSBC 05 after an update the engines were throwing errors. The error was in the construct of the engine swagger url where the two // before swagger dont work as an endpoint. --- CxHealthMonitor.ps1 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CxHealthMonitor.ps1 b/CxHealthMonitor.ps1 index f1f4e79..f22bdb2 100644 --- a/CxHealthMonitor.ps1 +++ b/CxHealthMonitor.ps1 @@ -1038,7 +1038,13 @@ Class EngineMonitor { for ($i = 0; $i -lt $script:config.monitor.retries; $i++) { try { if($this.cxVersion.StartsWith("9.3")){ - $resp = Invoke-WebRequest -UseBasicParsing -Uri "${apiUri}/swagger/index.html" -TimeoutSec $script:config.monitor.apiResponseTimeoutSeconds + # fix because on sast engine version 9.3hf16 the url like http://192.168.1.1:8088//swagger/index.html is not working because of the two / before swagger + if($apiUri -match '/$'){ + $newApiUri = ("{0}{1}" -f ${apiUri},"swagger/index.html") + }else{ + $newApiUri = "${apiUri}/swagger/index.html" + } + $resp = Invoke-WebRequest -UseBasicParsing -Uri $newApiUri -TimeoutSec $script:config.monitor.apiResponseTimeoutSeconds break } else{ $resp = Invoke-WebRequest -UseBasicParsing -Uri $apiUri -TimeoutSec $script:config.monitor.apiResponseTimeoutSeconds