Session 01 — Resource Enrichment
Why this matters
A PropertySource is a small setup script. It asks the controller for a few useful facts about the resource, then saves those facts so LogicMonitor can use them when it decides which modules apply.
Import this first
Import module-scaffold.json from the 01-propertysource folder in your extracted workshop bundle. You can also download this session’s personalized module-scaffold.json here.
How to import this module in LogicMonitor
Use these steps whenever a session asks you to import a JSON file:
Open the LogicMonitor
Modulespage.Select
Import from file.Choose the JSON file from the matching session folder in your extracted workshop bundle, or the personalized file downloaded from that session’s page.
If LogicMonitor reports:
This module has a conflict with a module that is currently installed.
select
View data comparison, thenOverwrite installed module.Finish the import, then continue with the session’s instructions. After editing a module’s AppliesTo, script, discovery filter, or datapoint settings, click Save, enter an Update Reason describing your changes, and complete the save before testing or leaving the page.
The workshop intentionally reuses module names as the design develops. Re-importing a module replaces the earlier workshop version with the next checkpoint version.
This is your starting point: the script is mostly complete, but a few small sections are left for you to finish. It is disabled with appliesTo: false() until you review the targeting rule.
Use scripts/student.groovy for the guided exercise. The complete implementation is scripts/reference.groovy.
What to do
The controller endpoint returns metadata like this:
{
"name": "Enterprise Fabric Controller",
"site": "training-east",
"version": "7.4.2"
}
In the module settings, change AppliesTo from
false()to:system.hostname =~ "studentname-04" && fabric.api.user && fabric.api.pass && !hasCategory("Training_Fabric")The hostname match limits this PropertySource to your resource. Your personalized guide replaces
studentname-04with your student ID.Best practice:
!hasCategory("Training_Fabric")makes this PropertySource a one-time enrichment step: after it successfully adds the category, it no longer applies. For a PropertySource that should keep resource metadata current, such as installed software versions, omit the!hasCategory(...)clause so it can run again and update changed values.Read through the supplied request flow before changing anything.
Fill in the marked hostname lookup using
hostProps.getto read thesystem.hostnameresource property. This tells the script where the workshop API lives.Uncomment the three output lines. Notice that one adds a category and the other two save controller details as resource properties.
Click Save, enter an Update Reason such as
Complete resource enrichment and AppliesTo, and complete the save.Run the saved PropertySource once against the workshop resource and check the resource details page.
Check your result
- The
Training_Fabriccategory is added. auto.fabric_siteandauto.fabric_versionappear on the resource.- Running it a second time does not target the resource again because it already has the category.
Discuss
Why is category assignment a better targeting mechanism than repeating API-specific logic in every DataSource?
The PropertySource checks the API-specific credentials once and assigns the Training_Fabric category. Each DataSource can then target that category with a short, consistent rule instead of repeating API checks.
Why should a PropertySource be safe to run again without creating duplicate results?
Running a PropertySource again is safe: it updates resource properties when the returned values change. The AppliesTo rule determines whether it gets another chance to run; use the one-time gate only when you do not need ongoing metadata refreshes.
What should happen when credentials or the API response are unavailable?
The script should stop with a failure status and avoid saving incomplete or misleading properties. It should report enough diagnostic information to troubleshoot the issue without printing secrets.
Key idea
The script performs enrichment; the module metadata controls where and when that enrichment runs.
If you get stuck
Open scripts/reference.groovy and compare the hostname lookup, output lines, and targeting rule with your version.