Caché Monitoring Guide - InterSystems Documentation
Caché Monitoring Guide - InterSystems Documentation
Caché Monitoring Guide - InterSystems Documentation
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Sample User-defined SNMP Monitor Class<br />
Parameter GROUPNAME = "MyTable";<br />
/// An integer metric counter<br />
Property Counter1 As %Monitor.Integer;<br />
/// Another integer metric counter<br />
Property Counter2 As %Monitor.Integer;<br />
/// A status indicator as a string data type<br />
Property Status As %Monitor.String;<br />
/// The method is REQUIRED. It is where the Application Monitor<br />
/// calls to collect data samples, which then get picked up by the<br />
/// ^SNMP server process when requested.<br />
Method GetSample() As %Status<br />
{<br />
set ..Counter1=$r(200)<br />
set ..Counter2=200+$r(100)<br />
set n=$r(4)<br />
set ..Status=$s(n=1:"Crashed",n=2:"Warning",n=3:"Error",1:"Normal")<br />
Quit $$$OK<br />
}<br />
}<br />
Before compiling this class in a user namespace, <strong>Caché</strong> must load supporting classes into the user namespace; these classes<br />
are required to store the data samples for SNMP.<br />
To load the classes, run ^%MONAPPMGR and do the following:<br />
• Select option 2, Manage Monitor Classes<br />
• Select option 3, Register Monitor System Classes.<br />
When you compile the sample class, it creates the SNMP.Sample.Example class to store the sample data.<br />
Important:<br />
Do not delete generated sample classes explicitly; if you select both the monitor and generated sample<br />
classes for deletion, the sample class routines remain although the monitor class routines are deleted, which<br />
causes an error. To ensure that all sample class routines are properly removed, delete only the application<br />
monitor class that generated it; when you delete the monitor class both the monitor class and generated<br />
sample class, as well as related routines for both classes, are deleted. For example, to deleted a sample<br />
class (for example, SNMP.Sample.Example), use the Management Portal or Studio to delete the monitor<br />
class from which it is generated (that is, SNMP.Example).<br />
Run ^%MONAPPMGR to activate the sample class and start the Application Monitor to collect samples:<br />
1. Select option 2, Manage Monitor Classes.<br />
2. Select option 1, Activate/Deactivate a Monitor Class.<br />
3. To see an numbered list of registered Monitor Classes, enter .<br />
4. Enter the number of Monitor Class you want to activate; for example, to activate a user-defined class named<br />
SNMP.Example, enter the number next to the class name.<br />
5. Select option 6, Exit (to return to the Application Monitor main menu).<br />
6. Select option 1, Manage Application Monitor.<br />
7. Select option 1, Start Application Monitor.<br />
8. Select option 5, Exit (to return to the Application Monitor main menu).<br />
9. Select option 6, Exit (to exit from Application Monitor main menu).<br />
Note:<br />
For information about configuring and using the Application Monitor, see <strong>Caché</strong> Application Monitor in the<br />
“Using the <strong>Caché</strong> Monitor” chapter.<br />
<strong>Caché</strong> <strong>Monitoring</strong> <strong>Guide</strong> 115