77 lines
3.0 KiB
Plaintext
77 lines
3.0 KiB
Plaintext
Compile subroutine MONA_SERVICES(@Service, @Params)
|
|
/***************************************************************
|
|
This subroutine is used to send messages to MonA directly from
|
|
within OpenInsight. It utilizes a C# DotNet DLL MonAOIApi.dll
|
|
which contains two classes, one for sending status updates, and
|
|
one for sending metrics. Also requires the Infineon.Monitoring.Mona.dll which contains the needed dotnet libraries.
|
|
|
|
Parameters:
|
|
Instruction: Used to determine which subroutine to execute.
|
|
Parm1:
|
|
-For Status updates represents the name of the monitor
|
|
-For Metrics updates represents the name of the monitor
|
|
Parm2:
|
|
-For Status updates represents the name of the status
|
|
-For Metric updates represents the name of the metric
|
|
Parm3:
|
|
-For status updates this represents the state of the object you are sending(Ok, Warning, Critical)
|
|
-For Metric updates this represents the numeric data that you wish to send.
|
|
***************************************************************/
|
|
|
|
Declare Subroutine Errmsg, Error_Services
|
|
Declare function Get_Status
|
|
#pragma precomp SRP_PreCompiler
|
|
|
|
$Insert LOGICAL
|
|
$Insert SERVICE_SETUP
|
|
$Insert REVDOTNETEQUATES
|
|
|
|
//Define the dotNet version
|
|
DotNetHandle = StartDotNet("","4.0")
|
|
|
|
//Specify the DLL
|
|
rv = Set_Property.NET(DotNetHandle, "AssemblyName", "D:\apps\OICurrent\IFXAPI\MonA\monaapi.dll")
|
|
|
|
//Define the classes
|
|
MonAApi = Create_Class.NET(DotNetHandle, "monaapi.monacommands", 0)
|
|
IF Get_Status(errCode) THEN
|
|
//ErrMsg(errCode)
|
|
|
|
END
|
|
GoToService else
|
|
Error_Services('Add', Service : ' is not a valid service request within the ' : ServiceModule : ' services module.')
|
|
end
|
|
|
|
Free_Class.Net(MonAApi)
|
|
|
|
return
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Service Parameter Options
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
Options MONITORS = 'SQL_BACKLOG', 'SQL_BACKLOG_WO_MAT', 'SQL_BACKLOG_WO_LOG'
|
|
Options STATES = 'OK', 'WARNING', 'CRITICAL'
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Services
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
Service SendStatus(MonitorName=MONITORS, StatusName, CurrentState=STATES)
|
|
|
|
MonInStatusUpdate = Send_Message.NET(MonAApi, "StatusUpdate", MonitorName:@FM:StatusName:@FM:CurrentState, "System.String":@FM:"System.String":@FM:"System.String")
|
|
|
|
IF Get_Status(errCode) THEN
|
|
Return
|
|
END
|
|
|
|
end service
|
|
|
|
Service SendMetric(MonitorName=MONITORS, MetricName, Number)
|
|
|
|
MonInStatusUpdate = Send_Message.NET(MonAApi, "MetricUpdate", MonitorName:@FM:MetricName:@FM:Number, "System.String":@FM:"System.String":@FM:"System.Double")
|
|
|
|
IF Get_Status(errCode) THEN
|
|
Return
|
|
END
|
|
end Service
|