Select to view content in your preferred language

Admin Utility for ArcGIS Monitor

1929
8
06-01-2023 04:15 PM
AndrewSakowicz
Esri Contributor
3 8 1,929

Admin Utility for ArcGIS Monitor is a python command line utility to assist administrators with:

  1. Deployment scripting: setup, users, labels, components, collections, analysis
  2. Batch updates: intervals, alerts

 

Downloadhttps://prof-services.maps.arcgis.com/home/item.html?id=129f2dbfde634f12bfae6f41121c9ff1

Usage

To run using provided executable for windows

dist\AdminUtility.exe -f sampleConfig.json -o xxx

-o values: setup, users, labels, components, collections, analysis, intervals, alerts

 

To run as python script

pip install -r requirements.txt

AdminUtility.py -f sampleConfig.json -o xxx

Note, this utility is not an ArcGIS Monitor product supported feature or a supported Esri product.

8 Comments
MaurusErni1
Occasional Explorer

Hi @AndrewSakowicz 

We're using ArcGIS Monitor 2023.3.1 and would like to use the Admin Tools to import/export configuration and settings from stage to stage.

The REST API OpenAPI documentation URL you mentioned above is invalid on our installation: https://xxxx:30443/arcgis/apidoc

Calling this URL with ArcGIS Monitor 2023.3.1 returns a 404 (not found). Any hint how/where to reach the REST API OpenAPI?

Regards
Maurus Erni

AndrewSakowicz
Esri Contributor

Thank you for pointing this out. I corrected the article.

Note, we are making several changes and are working on documenting and offering fully support Rest API in later releases.  We'll announce when it's ready. 

GeorgePan
Occasional Contributor

Hi Andrew,

I hope you had a great Independence Day and enough rest.

After testing the Admin Utility for ArcGIS Monitor, I feel it is so powerful and love it very much. It will be a powerful GIS automation tool to help us to publish ArcGIS monitor settings from Dev to Test, UAT, Staging, and Production environments.     

Can I bother you answering some questions to help us get more details?

Here are testing results and questions:

Test Results

   

Test Report of Admin Utility for ArcGIS Monitor

OS: Windows Server 2019

Version: ArcGIS Monitor 2023.3.1

Date: July 5, 2024

CMD/Python: Both

xyz Values

Test Results

Comments

Setup

No need for us

No testing has been applied

Users

Good - see the new users were added successfully

Fast and good

Labels

Good - see the new labels were added successfully

Fast and good

Components

Good - see the SQL Server was registered successfully

Fast and good

Collections

Good but how to set complicated union of lables

Need to add "encrypt": "false" for SQL Server accounts. Windows accounts do not need it.

Analysis

Error

The sample only has "file" parameter, no name, desc, and configuration. See error message Err-Ana-01

Intervals

Error

See the error message Err-Int-01

Alerts

Works well.

Slow

 

Questions

  1. Can we have sample in the configure file to modify / remove a user?

I saw the arcgis-monitor-admin-utility-20231229.1\Modules\AGM_API\Admin\users.py only has:

def add_user(self, payload)

Do you have API document for end point URLS and syntax?  Then we can add Python script for updating and deleting.

Such as:

route = "/arcgis/admin/security/users/delete/id"

response = requests.request("DELETE", self.url + route, json=payload, headers=headers,

        verify=False) "

 

  1. How to set a label’s description and color?

The current code only handles the label names. Should we change the following 2 things, to make it work?

  • The configuration from "labels":["xy"] to "labels": [{"name” : “xy", “description”: ”Desc”,"color":””}]
  • The payload = {"name":name} to {"name":name, “description”, desc, “color”: “#e5eb73”},
  1. Can you provide a sample configuration for how to set expression or labels for the following complicated case:

We have 2 labels “Dev” and “EFFMaps”, we can label a collection using the following Expression to make it have both properties, without creating a new label “Dev EFFMaps”. How to implement this in the Admin Utility?

GeorgePan_0-1720203440362.png

 

  1. For the -o analysis, can you provide a sample to set name, description, and Data Expression? I got the error message when use the setting. Any solutions?

"analysis":[

                {"name": "CodeSample", "description": "Code Sample Description","file":"C:\\temp\\ArcGISMonitor\\AnalysisSamples\\prodAnalysis.json"}],

Err-Ana-01:

7/05/2024 11:04:01 AM INFO: version:20231229.1

07/05/2024 11:04:01 AM INFO: Start

07/05/2024 11:04:01 AM INFO: Arguments: ConfigTry.json, analysis

07/05/2024 11:04:01 AM INFO: https://xyz.cc.uuuu:30443

07/05/2024 11:04:03 AM INFO: Get token success: True

07/05/2024 11:04:05 AM ERROR: Error adding analysisC:\temp\ArcGISMonitor\AnalysisSamples\prodAnalysis.json :{"success":false,"error":{"code":"E_VALIDATION_FAILED","status":400,"message":"Input validation failed for operation","details":["name is required."]}}

07/05/2024 11:04:05 AM INFO: End

 

"intervals":[

        {"minutes":65, "component_names":["ServerD01A","ServerD01B"], "component_types":["host_windows_strategy"]}],

"analysis":[

                {"name": "CodeSample", "description": "Code Sample Description","file":"C:\\temp\\ArcGISMonitor\\AnalysisSamples\\prodAnalysis.json"}],

  1. For the -o intervals, I got the following error, any solutions?

Setting:

"intervals":[

        {"minutes":65, "component_names":["ServerD01A","ServerD01B"], "component_types":["host_windows_strategy"]}],

 

 

Err-Int-01:

'Components_build' object has no attribute 'config'

Traceback (most recent call last):

  File "AdminUtility.py", line 10, in main

  File "Modules\Builder\builder.py", line 83, in __init__

  File "Modules\Builder\components_build.py", line 124, in update_intervals

AttributeError: 'Components_build' object has no attribute 'config'

None

Traceback (most recent call last):

  File "AdminUtility.py", line 10, in main

  File "Modules\Builder\builder.py", line 83, in __init__

  File "Modules\Builder\components_build.py", line 124, in update_intervals

AttributeError: 'Components_build' object has no attribute 'config'

  1. Can you provide a sample to unregister components in the configuration file?

 

Thanks so much for your great work!

 

George

GeorgePan
Occasional Contributor

Configuration json file is:


{
    "server":{
        "username": "SiteAdmin",
        "password": "SiteAdminPassword"
    },
    "password_encoding": false,  
    "setup":{
        "initial_admin":{
            "username": "admin",
            "password": "xyz",
            "email": "xyz",
            "name_first": "Primary",
            "name_last": "Administrator"} ,
        "pg_database":{
            "host": "xyz",
            "port": 5432,
            "database":"xyz",
            "username": "xy",
            "password": "xyz"},
        "register_monitoring": {
            "strategy_r_id":"boundary_physical_strategy",
            "connection":null}
        },

    "users":[
        {
            "username": "agm1_viewer",
            "password": "Password",
            "name_first": "agm1_viewer_first",
            "name_last": "agm1_viewer_last",
            "email": "agm1_viewer@xyz.com",
            "role": "viewer"
        },

        {
            "username": "agm1_admin",
            "password": "Password",
            "name_first": "agm1_admin_first",
            "name_last": "agm1_admin_last",
            "email": "agm1_admin@xyz.com",
            "role": "admin"
        }
        ],
   

    "labels":["xy", "xyz"],
    "register_localhost":
        {
            "name": null,
            "strategy_r_id":"host_windows_strategy",
            "connection": {
                "address": null,
                "os_credentials":true
            },
            "interval":null,
            "agent_name":"xyzx",
            "labels":["xyz"]
        },
    "components":[
        {    
            "name": "localPostgreSQL",
            "strategy_r_id":"database_pg_strategy",
            "description": "localPostgreSQL",
           
            "connection":{
                "address": "localhost:5432",
                "database":"ArcGISMonitorAppDataBase",
                "encrypt" : "false",
                "ssl":"false",
                "username":"arcgismonitorPDBAdmin",
                "password":"Password"
                },
            "interval":60,
            "agent_name":"arcgismon01.cc.uuuu",
            "labels":["DB", "PDB","TST"]
        }
    ],
    "unregister":["server1.cc.uuuu", "server2.cc.uuuu"],
    "collections":[
        {
            "name":"TestByCode",
            "description":"Test by code",
            "label_name":"TST"
        }
    ],
   
    "intervals":[
        {"minutes":65, "component_names":["Server01","Server1B"], "component_types":["host_windows_strategy"]}],
    "analysis":[
            {"name":"CodeSample", "description": "Code Sample Description","file":"C:\\temp\\ArcGISMonitor\\AnalysisSamples\\prodAnalysis.json"}
        ],
    "alerts":[    
        {
            "name": "CPU Utilized",
            "is_alerting_enabled": true,
            "operator": ">",
            "warning_threshold": 60,
            "critical_threshold": 85,
            "aggregation": "avg",
            "samples": 5,
            "collections":["Dev01"]
        },
        {
            "name": "Memory Utilized",
            "is_alerting_enabled": true,
            "operator": ">",
            "warning_threshold": 60,
            "critical_threshold": 85,
            "aggregation": "avg",
            "samples": 5,
            "collections":["Dev02"]
        }
    ]
}
AndrewSakowicz
Esri Contributor

A couple of comments:

  1. Some API calls and payloads, including registering components, will change in the next release.  
  2. At this point, I don't have updates for this admin utility or enhancements. 
  3. Instead, we are planning on finalizing and documenting API, including Python API in the next releases.
  4. So, my recommendation is that you evaluate your enhancement investment.  Instead of enhancing it, perhaps use it as is and for outstanding features configure them using UI, e.g. Collections, labels. 
  5. But if you still would like to enhance it, the "reverse engineering" using web dev tools might be the easiest way.  For example, to delete users AndrewSakowicz_0-1720300507140.pngAndrewSakowicz_1-1720300555175.png

     

GeorgePan
Occasional Contributor

Thanks so much for the quick feedback 🙂

Yes, reverse engineering is very helpful, and it has helped in finding some answers. 

Will the API documents come with ArcGIS Monitor 2024?

Another thing is I heard we still must enable the ArcGIS Server Primary admin account to register a GIS Server component in the new ArcGIS Server version 2024, like we did in version 2023.3, which is a risk on the security side. Is that true?       

Best regards,

George

AndrewSakowicz
Esri Contributor

API documents will not be available in this upcoming 2024.0, but is planned for later this year.  We'll share details later.

I would not interpret disabling PSA recommendation because it is a security risk, see Disable the primary site administrator account—ArcGIS Server | Documentation for ArcGIS Enterprise.  It is not a security risk per se. This recommendation reflects more of "least privilege access" principle.  If you don't need two ways of admin access, disable it.  But if you need to script admin functions or effective monitoring, need PSA.

GeorgePan
Occasional Contributor

Thanks so much for the quick feedback and sorry for costing your weekend's time Andrew, 🙏🍺

We are looking forward to seeing the version 2024.0 and appreciate your sharing the changing on APIs and documents in the future.

Yahoo! 

George

GeorgePan_0-1720416316189.jpeg