ConfigSource Configuration
Last updated on 18 September, 2024ConfigSources are embedded Groovy or PowerShell scripts to access, collect, and alert on resource configuration files and monitor changes. You can use settings in your LogicMonitor portal to configure your own custom ConfigSource.
Config files are available on the Resources page until the LMES data view period. If you want to view the config files later, you must use the API tokens to download the config files within the LMES data storage period. For assistance, contact customer success.
Warning: Monitored configuration files cannot exceed 3MiB in size per individual file.
Note: If the ability to monitor an alert on configuration files is not currently available in your LogicMonitor platform and you would like to learn more, contact customer success.
Requirements for Configuring a ConfigSource
To collect ConfigSource data for cloud resources, you must enable monitoring with a local collector. For more information, see Enable Monitoring via Local Collector.
Configuring a ConfigSource
- In the LogicMonitor navigation sidebar, select Modules.
- From My Module Toolbox, select Add.
- In the Add window, select ConfigSource.
The Add New ConfigSource window displays and contains tabs for Info, Access Group, Active Discovery, AppliesTo, Collection, and Config Check.
- On the Info tab, enter the following information:
- Name: Enter a unique name for the ConfigSource. Specify the platform or application and, if necessary, a specific component of the platform.
- (Optional) Description: Provide enough detail to ensure that the ConfigSource’s purpose can be determined.
- Resource Label: Tag the ConfigSource with keywords (related to its name, purpose, scope, and so on) that will facilitate a search for it.
- (Optional) Group: Specify the group to which the ConfigSource will be added. If this field is left empty, the ConfigSource is added to the default “@ungrouped” group. If you enter text that does not match an existing ConfigSource group, LogicMonitor creates a new group.
- (Optional) Technical Notes Preview: Enter any notes or technical information using markdown.
- Collection Method: Define the mechanism to collect configuration data.
- Select SCRIPT for script based configuration data collection. When you select SCRIPT, you can enable or disable the Multi-Instance toggle.
- Select BATCHSCRIPT for configuration data collection from a large number of instances using a script. When you select BATCHSCRIPT, the Multi-Instance toggle is enabled by default.
- Collection schedule: Select 1 hour (default), 4 hours, 8 hours, or 1 day interval for collecting data.
- (Optional) Multi-instance: Toggle this option on to make the ConfigSource multi-instance and enable the Active Directory tab (for more information, see What is Active Discovery?):
Multi-instance means there are multiple occurrences of a config file. For example, for multiple network surfaces on a Fortigate firewall, each containing its own config file.- (Optional) Toggle on Disable Discovered Instances to automatically find a ConfigSource’s instances on your resource, determine their display names or aliases, and keep them up-to-date.
- Toggle on Automatically Delete instances to automatically delete ConfigSource instances that no longer exist.
- In the Delete Instance Data dropdown, select whether to delete instances immediately (default) or after 30 days.
- In the Script Type field, select Embedded Groovy Script (default) or Embedded PowerShell Script, and then modify or enter the script provided in the text field. For more information, see Collector Attributes.
- Select the Test Script icon, select a resource, and then select Run Test.
- On the AppliesTo Tab, do the following:
- Enter AppliesTo scripting.
The AppliesTo field accepts LogicMonitor’s AppliesTo scripting as input to determine which resources are associated with this ConfigSource. For more information, see AppliesTo Scripting Overview. - Select the Test Script icon, select a resource, and then select Run Test.
This test returns a count of matching resources, and displays them in the AppliesTo Results panel.
- Enter AppliesTo scripting.
- On the Collection tab, do the following:
- In the Script Type dropdown, select one of the following options:
- Embedded Groovy Script (default)
When accessing configs through SSH or Telnet, use an embedded Groovy script so you can take advantage of expect syntax. For more information, see Custom Groovy for ConfigSource and Groovy/Expect Text-Based Interaction. Prior to running the embedded Groovy script, you must set your SSH authentication credentials as properties on the resource(s) you want to implement config monitoring. For more information, see Defining authentication credentials. - Embedded PowerShell Script
- Upload script file: Select Upload a Script, and then select the file, and then enter a script name/path and arguments. For more information, see External Scripting.
- Embedded Groovy Script (default)
- Select the Test Script icon, select a resource, and then select Run Test.
- In the Script Type dropdown, select one of the following options:
- On the Config Check tab, add config checks to the ConfigSource. For more information, see Adding Config Checks to a ConfigSource.
- Select Save.
- (Optional) Select Commit Version to save this version of the module to roll back to at a later date, and then do the following:
- (Optional) In the Commit a Version window, enter any version notes.
- (Optional) Toggle on Make this version public to make this module available to all LogicMonitor users in LM Exchange.
- Select Commit Version.
ConfigSource BatchScript Collector Output
The output of the script is expected to be in the following JSON format:
{
"data": {
"instance1": {
"configuration": "Configuration data of instance1"
},
"instance2": {
"configuration": "Configuration data of instance2"
},
"instance3": {
"configuration": "Configuration data of instance3"
}
}
}
Since the BatchScript configuration data collection method collects configuration for multiple instances at once, the ##WILDVALUE## token must be used in each configuration data definition to pass the instance name. If the ##WILDVALUE## contains invalid characters such as ‘:’, ‘#’, ‘\’, and space, the system returns “NoData”.
Note: The configuration data of an instance must be stored at the data.##WILDVALUE##.configuration
JSON path.
Example
In this example, ConfigSource XYZ with 2 instances Version
and Inventory
are applied to the device. The ConfigSource script generates the following output:
{
"data": {
"Version": {
"configuration": "Version configuration of the device"
},
"Inventory": {
"configuration": "Inventory configuration of the device"
}
}
}
The JSON value of the keys data.Version.configuration
and data.Inventory.configuration
returns the configuration data for the Version
and Inventory
instances respectively.