Skip to content

xMTinkerer/xm-labs-dummy-event-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Dummy Event Generator

This is a utility for generating some random event data. This was built for dumping data into Splunk, but could be used for any application.

Pre-Requisites

Files

  • Generator.js - The shared library for generating dummy events

Installation

Details of the installation go here.

xMatters set up

  1. Log in to your xMatters instance as a user with the Developer role (or anyone with access to the target communication plan). On the Developer tab, click Edit > Integration Builder for the target communication plan.
  2. Expand the Shared libraries section (if necessary) and click the + Add button
  3. Update the name at the top from My Shared Library to DataGenerator, then paste in the contents of the Generator.js file and hit Save.

Using the Generator

In a Integration Builder script, add all or some of the following code, depending on if you need corresponding active and terminated event pairs

var Generator = require( 'Generator' );

// Get the base event template
var activeEvent = Generator.getActiveEventBase();
var termEvent   = Generator.getTerminatedEventBase();

// Generate a "fake" GUID. 
var eventID     = Generator.generateBadGUID();

// Get some random event and recipient data
var eventData = Generator.getSampleEventData();
var recipData = Generator.getSampleRecipient();
var resolvedRecipData = Generator.getResolvedRecipients();

// Overwrite elements in Base Event
activeEvent = Generator.mergeRecursive( activeEvent, eventData );
activeEvent.recipients = recipData;
activeEvent.id = eventID;

// Ditto for terminated event
termEvent = Generator.mergeRecursive( termEvent, eventData );
termEvent.recipients.data = activeEvent.recipients.data.concat( resolvedRecipData );
termEvent.recipients.count = termEvent.recipients.data.length;
termEvent.recipients.total = termEvent.recipients.data.length;
termEvent.id = eventID;

Testing

Testing will depend on what you are doing with the data and how the script is triggered.

About

A shared library for generating dummy event data

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published