David Underhill · Jul 12, 2019 2m read

Basic Database Metrics example

This is a self contained class that can be run from the Intersystems Task Scheduler which records peak usage details for databases and licenses built up throughout the day and retaining 30 days history.

To schedule the task to run every hour:  

d ##class(Metrics.Task).Schedule()

You can also specify your own start time, stop time, and run interval:

d ##class(Metrics.Task).Schedule(startTime, stopTime, intervalMins)

Metrics are stored in ^Metrics in the namespace that the class resides in/is run from.

   "Available"     = lowest peak space available in the database (KB).  
   "Used"          = peak space used in the database (KB).  
   "Size"          = peak size of the database (KB).  
   "Free"          = lowest peak percentage free space of the database (%).  
   "MaxSize"       = peak maximum size paramater of the database (KB).  
   "DiskFreeSpace" = peak space available on the disk/volume for the database (KB).  
   "DiskSize"      = peak total size of the disk/volume for the database (KB).  
   "MaxFree"       = lowest peak percentage free space for the database based on MaxSize or DiskFreeSpace if not set (%).  
   "Customer"      = customer name on the license key.  
   "Expires"       = expiry date on the license key.  
   "Total"         = peak total units on the license key.  
   "Used"          = peak license units in use.  
   "Available"     = lowest peak license units available.

I am sure there are improvements to be made but hopefully a good starting point.

3 450
Discussion (3)2
Log in or sign up to continue

No, this works independantly. 

It could be a lack of understanding but the problem we had is that the monitor is just that, it provides warnings and alerts based on parameters or out of norm measurements.

We wanted an easy way to report on usage so we could spot trends/growth over time and possible future issues.

What if we just want to run this daily? Should we just specify Start Time of 00:00 and End Time of 23:59? Would the class file run for the entire day then?