Highlighted
Super Contributor.. Charles L. Super Contributor..
Super Contributor..
320 views

How to invoke restartSiteScope method API

In our effort to maintain Sitescope, we want to perform Sitescope restart automatically when certain error conditions are met, using Sitescope own's alerting function.

Currently, I have the following batch file which would in turn running powershell scripts.

powershell.exe -noprofile -executionpolicy bypass -InputFormat None -file E:\SiteScope\scripts\RestartSiSServiceStop.ps1

ping 127.0.0.1 -n 60 >NUL 2>&1 || ping ::1 -n 60 >NUL 2>&1

powershell.exe -noprofile -executionpolicy bypass -InputFormat None -file E:\SiteScope\scripts\RestartSiSServiceStart.ps1

RestartSiSServiceStop.ps1

try{
$ServiceName = "HP SiteScope"
Write-Host "Stopping $ServiceName Service ..."
Stop-Service $ServiceName -Verbose -Force
}
catch {
Write-Error $_.Exception.ToString()
Read-Host -Prompt "The above error occurred. Press Enter to exit."
}

RestartSiSServiceStart.ps1

try{
$ServiceName = "HP SiteScope"
$ServiceDetails = Get-Service $ServiceName
Write-Host "Starting $ServiceName service ..."
Start-Service $ServiceName
}
catch {
Write-Error $_.Exception.ToString()
Read-Host -Prompt "The above error occurred. Press Enter to exit."
}

It works most of the time. However, it would fail when Sitescope  takes too long to restart., because Sitescope would kill application, resulting in stopping child processes as well, and hence killed the script alert required to restart the Sitescope.

service: Thu Sep 28 18:34:06 2017 In ServiceStop
service: Thu Sep 28 18:34:06 2017 Stopping service, requested by user
service: Thu Sep 28 18:34:06 2017 cleaning up service
service: Thu Sep 28 18:34:06 2017 Shutdown request process successful
Thu Sep 28 18:34:25 2017 stopping 40632
Thu Sep 28 18:35:14 2017 stopping 26724
service: Thu Sep 28 18:36:06 2017 Service failed to wait for application shutdown, killing application
service: Thu Sep 28 18:36:06 2017 Stopping monitoring process: 26720, result: 1
service: Thu Sep 28 18:36:06 2017 Stopping child processes: 26720
Thu Sep 28 18:36:07 2017 stopping perfex 39828
Thu Sep 28 18:36:07 2017 stopping perfex 33524
Thu Sep 28 18:36:07 2017 stopping perfex 12724
Thu Sep 28 18:36:07 2017 stopping perfex 40756
Thu Sep 28 18:36:07 2017 stopping perfex 30088
Thu Sep 28 18:36:07 2017 stopping perfex 28900
Thu Sep 28 18:36:07 2017 stopping perfex 54020
Thu Sep 28 18:36:07 2017 stopping perfex_dispatcher 40772
Thu Sep 28 18:36:07 2017 stopping perfex 21356
Thu Sep 28 18:36:07 2017 stopping perfex 40848
Thu Sep 28 18:36:07 2017 stopping perfex 69392
Thu Sep 28 18:36:07 2017 stopping perfex 28020
Thu Sep 28 18:36:07 2017 stopping perfex 65068
Thu Sep 28 18:36:07 2017 stopping perfex 37216
Thu Sep 28 18:36:07 2017 stopping perfex 15564
Thu Sep 28 18:36:07 2017 stopping cmd 38280
Thu Sep 28 18:36:07 2017 stopping cmd 50156
Thu Sep 28 18:36:07 2017 stopping powershell 6920

Is there any way for us to invoke the restartSiteScope() method API as a way to restart Sitescope service properly?

Best Regards,

Charles L.

 

Labels (1)
0 Likes
1 Reply
Micro Focus Expert
Micro Focus Expert

Re: How to invoke restartSiteScope method API

See

https://community.saas.hpe.com/t5/Application-Perf-Mgmt-BAC-BSM/How-to-invoke-restartSiteScope-method-API/m-p/1616216/highlight/false#M62232

Siggi

Customer Support
Micro Focus

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.