Search
  • Nikhil Verma

Vmware Unified Access gateway(UAG) External Monitoring

UAG appliance is used as reverse proxy for applications and provide secure connection. We can monitor UAG appliance either by API call scripts or you can create Custom monitor in AVI LB and set below python script.


Here are steps to perform this :


1) Create Monitoring account in UAG's , since we have multiple UAG's so we have used script to create account in all UAG's.



====================================================================================
# Title : Python script for creation of monitoring account in UAG
# Author : Nikhil Verma
# Version : " v1.0"
====================================================================================

import requests 
requests.packages.urllib3.disable_warnings() #"Ignore UAG SSL warnings"
from requests.auth import HTTPBasicAuth 
import json


url = 'https://uagIP:9443/rest/v1/config/adminusers'
  
 
payload = {
    'name': 'test',
    'password': 'test@12345',
    'enabled':True,
    'roles' : ["ROLE_MONITORING"],
    'noOfDaysRemainingForPwdExpiry':0
}

headers = {'Content-type': 'application/json'}
r = requests.put(url2,data=json.dumps(payload),headers=headers,verify=False,auth = HTTPBasicAuth('admin', 'password'))
print(r.text)
users = session.get(url2, verify=False,auth = HTTPBasicAuth('admin', 'password'))
print(users.text)




2) We need to create External health monitor in AVI LoadBalancer :



====================================================================================
# Title : Python script for Monitoring Unified Access Gateway Horizon Tunnels
# Author : Nikhil Verma
# Version : " v1.0"
====================================================================================

import requests 
requests.packages.urllib3.disable_warnings()
from requests.auth import HTTPBasicAuth 
from lxml import etree


url = 'https://$IP:$PORT/rest/v1/monitor/stats'

  
# Making a get request 
response = requests.get(url,verify=False,auth = HTTPBasicAuth('test', 'password')) 
  
# print request object 
#print(response) 
data = response.text.encode('utf-8')

tree = etree.fromstring(data)
blast_status = tree.xpath("//viewEdgeServiceStats/protocol[@name='blast']/status/status")[0]
pcoip_status = tree.xpath("//viewEdgeServiceStats/protocol[@name='pcoip']/status/status")[0]
UTS_status = tree.xpath("//viewEdgeServiceStats/protocol[@name='utserver']/status/status")[0]
print(blast_status.text, pcoip_status.text,UTS_status.text)




3) This Monitor need to be attached at port 9443 which is used to monitor health status


I hope this Blog will help you to do granular health checks and will stop sending requests to UAG if monitor is down



23 views0 comments

Recent Posts

See All