Question
· Mar 10, 2022

Python - create report with License usage data

I am in the process of creating a python report writer that includes the information contained in "License Usage" page of the management portal. I think I have a handle on the local values contained in the report using the %SYSTEM.License class I have those defined using these methods:

  Current License Units Used -     ->  LUConsumed

  Maximum License Units Used  --> LUMaxConsumed

 License Units Enforced               --> KeyEnforcedUnits

License Units Authorized            --> KeyLicenseUnits

Current Connections                   --> InstanceConnections

Maximum Connections              --> InstanceConnectionsMax

The only anomaly I found here is that in a terminal session using Objectscript :

  write ##CLASS(%SYSTEM.License).InstanceConnectionsMax()  

   3

  write ##CLASS(%SYSTEM.License).InstanceConnections()

  2

But in Python those methods return None. Not sure if there is an alternative approach to get those values through Python or why Objectscript produces the correct results and Python does not.

Finally; I can not find any reference to what Class or methods to use to obtain the distributed values of each of those 6 data elements.

Product version: Caché 2017.1
Discussion (5)1
Log in or sign up to continue

Hi,

You can use below code to get license information

   import iris   
   // make sure to connect with %SYS namespace 
    ref = iris.cls("SYS.Stats.Dashboard").Sample()
    content = {
    LicenseCurrent = ref.LicenseCurrent
    LicenseCurrentPct =  ref.LicenseCurrentPct
    LicenseHigh = ref.LicenseHigh
    LicenseHighPct = ref.LicenseHighPct
    LicenseLimit = ref.LicenseLimit
    LicenseType = ref.LicenseType
     

For more details kindly read the below article:

https://community.intersystems.com/post/building-iris-responsive-dashboa...

Thanks

I am not sure what screen shot would be helpful.

I did find that the class ""%Monitor.System.License" contains the distributed license parameters that I need. What I am trying to figure out is the correct syntax to get a handle to the object. I tried:

   hdl = database.openid("%Monitor.System.License",'',-1,-1)

But this fails.

I also tried:

  hdl = database.run_class_method("%Monitor.System.License","%OpenId",[])

 But this object does not have the '%OpenId' method

If I can figure the correct syntax I can use hdl.get(xx) to get what I need for the distributed license attributes.

This is a summary of the report that I am trying to create through a Python process:

For the values in the "local" column I am using the %SYSTEM.License class and setting the values as follows:

  Current License Units Used -     ->  LUConsumed

   Maximum License Units Used  --> LUMaxConsumed

   License Units Enforced               --> KeyEnforcedUnits

   License Units Authorized            --> KeyLicenseUnits

   Current Connections                   --> InstanceConnections

   Maximum Connections              --> InstanceConnectionsMax

The values appear to be match the Management Portal values. The instanceConnections and InstanceConnectionsMax in Python are Null so that is an open issue

For the values in the "distributed" column  are not completely clear. The first two values appear to be from the "%Monitor.SystemLicense" But this is my best guess. So for the distributed column I have:

      hdl = database.run_class_method("%Monitor.System.License","%New",[])

    Current License Units Used -     -->  hdl.get('CurrentUsedDist')

   Maximum License Units Used  -->hdl.get('MaxUsedDist')

   License Units Enforced               --> ?

   License Units Authorized            --> ?

   Current Connections                   --> ?

   Maximum Connections              --> ?

At this point I would like know how to get the missing distributed license values. Also, is the "%Monitor.System.License" the correct source for some of the distributed values?