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.
Hi,
You can use below code to get license information
For more details kindly read the below article:
https://community.intersystems.com/post/building-iris-responsive-dashboa...
Thanks
That is helpful but I still have open issues.
I am trying to determine why instanceConnections() instanceConnectionsMax() produce the correct answers in a Terminal session but return None in Python.
I also, if it is available would like to know where to find the values to use for the 'Distributed' column of that web page
Can you please share screenshots to understand the issue?
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?