Hi , is ther a way to catch a situation when arc gis server / portal is up and running but web adaptor is down?
Solved! Go to Solution.
In python:
import json
import http.client
import urllib.parse
url = 'your.web.adaptor/url'
parsed_url = urllib.parse.urlparse(url)
conn = http.client.HTTPSConnection(parsed_url.hostname, parsed_url.port)
conn.request('GET', url)
response = conn.getresponse()
if not response.status or response.status < 200 or response.status > 299:
# your web adaptor is down!
# do something here, send a message or what have you
conn.close()
In PowerShell, you can throw this in a forever loop to ping the URL every 10 seconds.
try
{
$Response = Invoke-WebRequest -Uri "your.web.adaptor/url" -TimeoutSec 2
$StatusCode = $Response.StatusCode
} catch {
$StatusCode = $_.Exception.Response.StatusCode.value__
}
if ( $StatusCode -eq 200 )
{
# All is well, wait 10 seconds
Start-Sleep -Seconds 10
}
else
{
# It's not communicating!
# Do something here
}
Of course, what you put into the "do something here" sections depends on your setup, how you want to be notified, etc. But pinging the web adaptor repeatedly is easy enough.
Kind of...
I generally monitor the health of Portal or Server through the REST api. I have a condition on my monitoring that if it does not get a response and/or returns something other than:
portal is ready
or
"success":true
That it starts dropping me alerts to investigate.
Hi , thank you gir the answer , can you alaborate more on how to create this conditon and can it be done on the new 2023 version ?
@JCan gave you a good python based away to check if something was up or down, but if you wanted to use Zabbix or Solarwinds for example, you could check here...
https://portal.yourportaladaptor.com/portal/portaladmin/healthCheck
Check for "portal is ready" in the body.
and for your hosting servers....
https://host.yourhostadaptor.com/webadaptorname/rest/info/healthCheck
check for "success":true in the body if you disabled the gui. If not, you'll see something different.
In python:
import json
import http.client
import urllib.parse
url = 'your.web.adaptor/url'
parsed_url = urllib.parse.urlparse(url)
conn = http.client.HTTPSConnection(parsed_url.hostname, parsed_url.port)
conn.request('GET', url)
response = conn.getresponse()
if not response.status or response.status < 200 or response.status > 299:
# your web adaptor is down!
# do something here, send a message or what have you
conn.close()
In PowerShell, you can throw this in a forever loop to ping the URL every 10 seconds.
try
{
$Response = Invoke-WebRequest -Uri "your.web.adaptor/url" -TimeoutSec 2
$StatusCode = $Response.StatusCode
} catch {
$StatusCode = $_.Exception.Response.StatusCode.value__
}
if ( $StatusCode -eq 200 )
{
# All is well, wait 10 seconds
Start-Sleep -Seconds 10
}
else
{
# It's not communicating!
# Do something here
}
Of course, what you put into the "do something here" sections depends on your setup, how you want to be notified, etc. But pinging the web adaptor repeatedly is easy enough.
Thank you for now it will work