Moogsoft Docs

Config Bot Module

The Config Bot module allows you to read configuration files within LAMbots and Moobots.

It retrieves valid JSON configuration files found in $MOOGSOFT_HOME/config and performs a direct read from the file system before delivering the JSON Object to the calling bot. The module is available for all bots but can only be used for reading and storing global configuration files.


Before you use the Config Bot module, ensure the following conditions are met:

  • The configuration file is in valid JSON.
  • The configuration file is in $MOOGSOFT_HOME/config
  • The configuration is present on the file system as the process running the bot.

Config Bot Examples

If you wanted to create a URL that links to AIOps Situations, the Config Bot module can be used to dynamically retrieve the base URL of the AIOps instance from servlets.conf :

var config = MooBot.loadModule('Config');
var servletsConf = config.getConfig('servlets.conf');
if (servletsConf) {
    moogURL = servletsConf.webhost;

Error reporting

The following error messages are returned if the configuration file cannot be opened, the contents returned are null or if the JSON is invalid:

INFO :[]:813 +| /export/src/incident/build/config/bad.conf (No such file or directory): Unable to open file /export/src/incident/build/config/bad.conf|+

WARN :[]:105 +|Failed to parse file /export/src/incident/build/config/bad.conf, returned null contents|+

WARN :[]:112 +|File [/export/src/incident/build/config/bad.conf] is either missing, unreadable or is not valid JSON.|+

Best Practices

You should follow these guidelines when using the Config Bot module:

  • It should only be used within the constraints of the OnLoad() function.
  • Making multiple calls to this module may impact the performance of the Bot.
  • Custom config files should be kept in a subdirectory of config and named appropriately.
  • Comment any config file extensively so other users can understand the context of their use.