inspect_site_properties

Inspect site properties

In [1]:
from arcgis.gis import *
from getpass import getpass
In [2]:
#Connect to Enterprise
password = getpass()
gis = GIS("https://esriwebgis.webgistesting.net/portal/",'admin',password)
········
In [3]:
# Connect to geoanalytics server
server_list = gis.servers
server2 = server_list[1]

print(type(server2))
print(server2.connection.baseurl)
<class 'arcgis.server.managers.Server'>
https://ESRIgeoanalytics.webgistesting.net/server/rest/services

Inspect GeoAnalytics server site properties

Find the following:

  • number of clusters
  • number of machines
  • version of servers in the cluster
In [4]:
# Create a site manager object
from arcgis.server.managers import SiteManager
In [5]:
server2_sitemgr = SiteManager(connection=server2.connection, 
                              url='https://ESRIgeoanalytics.webgistesting.net/server/admin')

Find the list of machine clusters

In [6]:
server2_sitemgr.clusters
Out[6]:
Cluster([('clusters',
          [{'clusterName': 'default',
            'clusterProtocol': {'tcpClusterPort': 4004, 'type': 'TCP'},
            'configuredState': 'STARTED',
            'machineNames': ['10.0.1.225', '10.0.0.126', '10.0.1.232']}])])

General info about the cluster, the version, connection privilege

In [7]:
server2_sitemgr.info
Out[7]:
Info([('currentversion', '10.5.0'),
      ('timezone',
       {'daylightsavings': '',
        'displayname': '',
        'olsonid': '',
        'windowsid': ''}),
      ('fullVersion', '10.5.0'),
      ('loggedInUserPrivilege', 'ADMINISTER'),
      ('currentbuild', '6491'),
      ('loggedInUser', '0123456789ABCDEF::admin')])
In [8]:
server2_machine_mgr = server2_sitemgr.machines
machine_list = server2_machine_mgr.machines
len(machine_list)
Out[8]:
3
In [9]:
mac1 = machine_list[0]
mac1
Out[9]:
Machine([('platform', 'Linux-amd64-4.4.0-45-generic'),
         ('appServerMaxHeapSize', 256),
         ('ServerStartTime', 1487785131675),
         ('webServerSSLEnabled', True),
         ('ports',
          {'DerbyPort': 4003,
           'HTTP': 6080,
           'HTTPS': 6443,
           'JMXPort': 4001,
           'NamingPort': 4002,
           'OpenEJBPort': 4000,
           'tcpClusterPort': 4004,
           'webSocketsPort': 6180}),
         ('webServerCertificateAlias', 'SelfSignedCertificate'),
         ('machineName', '10.0.0.126'),
         ('socMaxHeapSize', 64),
         ('configuredState', 'STARTED'),
         ('synchronize', False),
         ('webServerMaxHeapSize', -1),
         ('adminURL', 'https://10.0.0.126:6443/arcgis/admin')])
In [38]:
mac1.adminURL
Out[38]:
'https://10.0.0.126:6443/arcgis/admin'
In [44]:
mac1.sslcertificates
Out[44]:
{'certificates': ['selfsignedcertificate']}
In [45]:
mac1.sslcertificate('selfsignedcertificate')
Out[45]:
{'#1': 'ObjectId: 2.5.29.14 Criticality=false',
 '0000': 'EA D7 46 66 CA 7A B5 72   BA 32 82 9D DD 3C 37 2B  ..Ff.z.r.2...<7+',
 '0010': 'F0 47 FD 78                                        .G.x',
 ':': '',
 'Alias name': 'selfsignedcertificate',
 'Certificate chain length': '1',
 'Certificate fingerprints': '',
 'Certificate[1]': '',
 'Creation date': 'Feb 22, 2017',
 'Entry type': 'PrivateKeyEntry',
 'Extensions': '',
 'Issuer': 'CN=10.0.0.126, O=SelfSignedCertificate',
 'KeyIdentifier [': '',
 'MD5': '80:00:28:F2:FC:43:BD:D6:36:B6:2B:78:6C:03:22:3C',
 'Owner': 'CN=10.0.0.126, O=SelfSignedCertificate',
 'SHA1': 'E9:1D:CD:69:44:47:E9:EA:37:6E:8F:83:FC:7A:3F:AA:CD:9B:CA:80',
 'SHA256': '27:C7:1B:27:C1:EF:22:07:0D:23:CD:B7:24:23:B7:C4:AD:8D:6B:C1:82:07:1C:A3:10:43:83:AC:9A:A4:C5:25',
 'Serial number': '57ea8242',
 'Signature algorithm name': 'SHA256withRSA',
 'SubjectKeyIdentifier [': '',
 'Valid from': 'Wed Feb 22 17:38:54 UTC 2017 until: Fri Dec 31 17:38:54 UTC 2049',
 'Version': '3',
 ']': ''}