Select to view content in your preferred language

Web adaptor is down

708
5
Jump to solution
08-23-2023 01:23 PM
IrisHadarStltd
New Contributor III

 Hi , is ther a way to catch a situation when arc gis server / portal is up and running but web adaptor is down?

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

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.

- Josh Carlson
Kendall County GIS

View solution in original post

5 Replies
John_Spence
Occasional Contributor III

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.

0 Kudos
IrisHadarStltd
New Contributor III

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 ?

0 Kudos
John_Spence
Occasional Contributor III

@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.

0 Kudos
jcarlson
MVP Esteemed Contributor

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.

- Josh Carlson
Kendall County GIS
IrisHadarStltd
New Contributor III

Thank you for now it will work 

0 Kudos