Caché Monitoring Guide - InterSystems Documentation
Caché Monitoring Guide - InterSystems Documentation
Caché Monitoring Guide - InterSystems Documentation
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Using the <strong>Caché</strong> MonitorClass MyMetric.Freespace Extends %Monitor.Adaptor [ ProcedureBlock ]{/// Initialize the list of datasets and freespace.Method Initialize() As %Status{s ..Rspec = ##class(%Library.ResultSet).%New("SYS.Database:FreeSpace")}}d ..Rspec.Execute("*",0)Quit $$$OK6. Override a method named GetSample(). GetSample() is called repeatedly until a statusof 0 is returned. The user writes code to populate the metrics data for each sample instance.Class MyMetric.Freespace Extends %Monitor.Adaptor [ ProcedureBlock ]{/// Get dataset metric sample./// A return code of $$$OK indicates there is a new sample instance./// A return code of 0 indicates there is no sample instance.Method GetSample() As %Status{// Get freespace data}Set stat = ..Rspec.Next(.sc)// Quit if we have done all the datasetsIf 'stat Q 0// populate this instanceSet ..DBName = ..Rspec.Get("Directory")Set ..FreeSpace = ..Rspec.Get("Available")// quit with return value indicating the sample data is readyQ $$$OK7. Compile the class. The class is shown below:22 <strong>Caché</strong> <strong>Monitoring</strong> <strong>Guide</strong>