Skip to main content

Expose Active Moolets

You can expose which Moolets are running by adding functions to a Moobot. The functions are:

  • Bot.isActive: Returns whether the specified Moolet is active or not.

  • Bot.getActiveMoolets: Returns a list of all active Moolets in the system.

isActive

Returns whether the specified Moolet is active or not.

Request Argument

Name

Type

Required

Description

<mooletName>

String

Yes

Name of a Moolet.

Return Parameter

Type

Description

Boolean

'true' indicates the Moolet is active, 'false' indicates it is inactive.

Example

For example, you could use the function to return a logger warning if the ServiceNow Moolet is not running:

if(Bot.isActive('ServiceNow')) 
        { 
                var inform = mooletInforms.create('ServiceNow'); 
                inform.setSubject("ticket"); 
                inform.setDetails({sig_id: sigId}); inform.send(); 
        } 
else 
        { 
                logger.warning("ServiceNow is not running - situation " + sigId + " was not sent"); 
        }

getActiveMoolets

Returns a list of all active Moolets in the Moogsoft Enterprise system.

Request Argument

None.

Return Parameter

Type

Description

List

A list of all active Moolets in the Moogsoft Enterprise system.

Example

You could use the function to return which Moolets are running if a specified Alert Workflow Engine Moolet is active:

var alert = moogdb.createAlert(event); 
if(alert) 
        {
                logger.info("New Alert Id: " + alert.value("alert_id")); 
                if(Bot.isActive('AlertWorkflows')) 
                { 
                        logger.warning("Moolets running are: \n" + Bot.getActiveMoolets()); 
                }
        }

An example log might return as follows:

WARN : [3:AlertBuilder][20190301 19:05:20.808 +0000] [AlertBuilder.js:128] +|Moolets running are: [MaintenanceWindowManager, TeamsMgr, AlertBuilder, SituationWorkflows, Housekeeper, Default Cookbook, Indexer, EnrichmentWorkflows, AlertWorkflows, EventWorkflows, SituationMgr, SituationRootCause]|+