Question
· Nov 28, 2017

How to read Health Monitor sensors and/or warnings and alerts programmatically?

In short, I wanted to react on CPUusage warnings and alerts with my own actions. It seemed that it was possible in my Caché version (2015.1): 
http://docs.intersystems.com/cache201513/csp/docbook/DocBook.UI.Page.cls...

But all my attempts silently failed. Callback code was as simple as possible: 

Class %z.Monitor.Health Extends SYS.Monitor.Health.AbstractCallback
{
/// This method is called for every Health Monitor sensor reading.<br>
///...
Method Callback(type As %Integer, sensor As %String, value As %String, mean As %String, sigma As %String, rule As %String, valuelist As %List, ByRef severity As %Integer) As %Status
{
 set sc=1
 try {
   set ^%zlog($i(^%zlog))="type="_type_" sensor="_sensor_" value="_value
 catch {
   set ^%zlog($i(^%zlog))=$ze
 
 quit sc
}

}

I've got my alerts written to alerts.log and cconsole.log, tried it with started or stopped Health Monitor - no changes, my callback was never called.

Checking the latest documentation (http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=...) I've noticed that callback fuctionality is absent. So, bearing in mind future upgrade to Caché 2017.2, I decided to stop further attempts to get callback working.

The question is: if callback functionality is excluded, what approach should I take to detect performance warning/alerts, e.g. CPUusage?
I understand that I can callout something at the OS lever (supporting both Linux and Windows), but maybe a better approach exists.
Any help would be great appreciated.

Discussion (6)1
Log in or sign up to continue