Question
Alexey Maslov · 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.

00
1 0 6 235

Replies

Thank you, Eduard.

Is it possible to do something with an "old" Cache 2015.1?

I have no objection to upgrade, but according to our previous experience the movement of customers' sites will not be quick. So I'd like to find a solution which will be useable from 2015.1 to 2018.2.

Yes, I did.
It did not seem working, STOP / START of the System Monitor didn't help.
I lost my interest to Callback functionality because of its absence in newer Caché version, so I would not investigate it anymore.

Option 2 - notification method is available in 2015.1

My first guess was that it concerned Application Monitor alerts only, while I was mostly interested in Health monitor sensors reading.

Have you registered your Callback class with Health Monitor ( Configure Callback option in the Set Health Monitor Options submenu of the ^%SYSMONMGR utility)?