Utility functions


The purpose of these functions is to notify operators with custom messages.

writeToOperator

This function is a simple wrapper around createMessage and sendMessageToAllViewer that can simplify your functions. It takes two parameters: the message text and the color. The function then sends the message to all viewers.


//
// Function: trace
//
// Description:

//         Creates a message and sends it to all logged-in operators

// 

function writeToOperator (m,c)

message = createMessage(m)
message.COLOR = c
sendMessageToAllViewers(message)

return false

Trace functions

The trace functions help you when developing rules and functions.

Trace

Like the writeToOperator function, trace takes two parameters: the message text and the color. The trace function checks a flag before sending the message, so the trace facility can be turned on and off.

//
// Function: trace
//
// Description:
//  Sends a message to all viewers for rule debugging purposes.
//  This function checks the traceEnabled flag to see if
//  tracing is enabled. The traceEnabled flag is set by the
//  traceon and traceoff functions.
//
function trace(text,color)

session traceEnabled

if traceEnabled == true then

    txt = text
    msg = createMessage(txt)
    msg.COLOR = color
    sendMessageToAllViewers(msg)

endif
    
return 0

traceon

This function sets the traceEnabled flag to true.

//
// Function: traceoon
//
// Description:
//  Sets the traceEnabled variable to true to turn tracing
//  on. See the trace function.
//
function traceon()

session traceEnabled

traceEnabled = true

trace("Rule debug trace enabled", RED)

return 0

traceoff

This function disables tracing.

//
// Function: traceoff
//
// Description:
//  Sets the traceEnabled variable to false to turn tracing
//  off. See the trace function.
//
// Copyright (c) 2011-2012, BMC Software, Inc.
//
function traceoff()

session traceEnabled

trace("Disable rule debugging trace", RED)

traceEnabled = false

return 0

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*