|
| 1 | +--- |
| 2 | +external help file: Logic.Monitor-help.xml |
| 3 | +Module Name: Logic.Monitor |
| 4 | +online version: |
| 5 | +schema: 2.0.0 |
| 6 | +--- |
| 7 | + |
| 8 | +# Import-LMLogicModuleFromFile |
| 9 | + |
| 10 | +## SYNOPSIS |
| 11 | +Imports a LogicModule into LogicMonitor using the V2 import endpoints. |
| 12 | + |
| 13 | +## SYNTAX |
| 14 | + |
| 15 | +### FilePath |
| 16 | +``` |
| 17 | +Import-LMLogicModuleFromFile -FilePath <String> [-Type <String>] [-Format <String>] |
| 18 | + [-FieldsToPreserve <String>] [-HandleConflict <String>] [-ProgressAction <ActionPreference>] |
| 19 | + [<CommonParameters>] |
| 20 | +``` |
| 21 | + |
| 22 | +### File |
| 23 | +``` |
| 24 | +Import-LMLogicModuleFromFile -File <Object> [-Type <String>] [-Format <String>] [-FieldsToPreserve <String>] |
| 25 | + [-HandleConflict <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>] |
| 26 | +``` |
| 27 | + |
| 28 | +## DESCRIPTION |
| 29 | +The Import-LMLogicModuleFromFile function imports a LogicModule from a file path or file data using the new XML and JSON import endpoints. |
| 30 | +Supports various module types including datasources, configsources, eventsources, batchjobs, logsources, oids, topologysources, functions, and diagnosticsources. |
| 31 | + |
| 32 | +## EXAMPLES |
| 33 | + |
| 34 | +### EXAMPLE 1 |
| 35 | +``` |
| 36 | +#Import a datasource module from XML |
| 37 | +Import-LMLogicModuleFromFile -FilePath "C:\LogicModules\datasource.xml" -Type "datasources" -Format "xml" |
| 38 | +``` |
| 39 | + |
| 40 | +### EXAMPLE 2 |
| 41 | +``` |
| 42 | +#Import a logsource module from JSON with conflict handling |
| 43 | +Import-LMLogicModuleFromFile -FilePath "C:\LogicModules\logsource.json" -Type "logsources" -Format "json" -HandleConflict "FORCE_OVERWRITE" |
| 44 | +``` |
| 45 | + |
| 46 | +### EXAMPLE 3 |
| 47 | +``` |
| 48 | +#Import an eventsource from file data (read file content first with -Raw parameter) |
| 49 | +$fileData = Get-Content -Path "C:\LogicModules\eventsource.xml" -Raw |
| 50 | +Import-LMLogicModuleFromFile -File $fileData -Type "eventsources" -Format "xml" |
| 51 | +``` |
| 52 | + |
| 53 | +### EXAMPLE 4 |
| 54 | +``` |
| 55 | +#Import with fields to preserve |
| 56 | +Import-LMLogicModuleFromFile -FilePath "C:\LogicModules\datasource.json" -Type "datasources" -Format "json" -FieldsToPreserve "description,appliesTo" |
| 57 | +``` |
| 58 | + |
| 59 | +## PARAMETERS |
| 60 | + |
| 61 | +### -FilePath |
| 62 | +The path to the file containing the LogicModule to import. |
| 63 | +The function will read the file content automatically. |
| 64 | + |
| 65 | +```yaml |
| 66 | +Type: String |
| 67 | +Parameter Sets: FilePath |
| 68 | +Aliases: |
| 69 | + |
| 70 | +Required: True |
| 71 | +Position: Named |
| 72 | +Default value: None |
| 73 | +Accept pipeline input: False |
| 74 | +Accept wildcard characters: False |
| 75 | +``` |
| 76 | +
|
| 77 | +### -File |
| 78 | +The raw file content of the LogicModule to import as a string. |
| 79 | +Use Get-Content with -Raw parameter to read file content properly (e.g., Get-Content 'file.json' -Raw). |
| 80 | +
|
| 81 | +```yaml |
| 82 | +Type: Object |
| 83 | +Parameter Sets: File |
| 84 | +Aliases: |
| 85 | + |
| 86 | +Required: True |
| 87 | +Position: Named |
| 88 | +Default value: None |
| 89 | +Accept pipeline input: False |
| 90 | +Accept wildcard characters: False |
| 91 | +``` |
| 92 | +
|
| 93 | +### -Type |
| 94 | +The type of LogicModule. |
| 95 | +Valid values are "datasources", "configsources", "eventsources", "batchjobs", "logsources", "oids", "topologysources", "functions", "diagnosticsources". |
| 96 | +Defaults to "datasources". |
| 97 | +
|
| 98 | +```yaml |
| 99 | +Type: String |
| 100 | +Parameter Sets: (All) |
| 101 | +Aliases: |
| 102 | + |
| 103 | +Required: False |
| 104 | +Position: Named |
| 105 | +Default value: Datasources |
| 106 | +Accept pipeline input: False |
| 107 | +Accept wildcard characters: False |
| 108 | +``` |
| 109 | +
|
| 110 | +### -Format |
| 111 | +The format of the LogicModule file. |
| 112 | +Valid values are "xml" or "json". |
| 113 | +Defaults to "json". |
| 114 | +
|
| 115 | +```yaml |
| 116 | +Type: String |
| 117 | +Parameter Sets: (All) |
| 118 | +Aliases: |
| 119 | + |
| 120 | +Required: False |
| 121 | +Position: Named |
| 122 | +Default value: Json |
| 123 | +Accept pipeline input: False |
| 124 | +Accept wildcard characters: False |
| 125 | +``` |
| 126 | +
|
| 127 | +### -FieldsToPreserve |
| 128 | +Optional. |
| 129 | +Comma-separated list of fields to preserve during import. |
| 130 | +Only applies to JSON imports. |
| 131 | +Defaults to preserving none of the fields. |
| 132 | +Valid values are "NAME", "APPLIES_TO_SCRIPT", "COLLECTION_INTERVAL", "ACTIVE_DISCOVERY_INTERVAL", "ACTIVE_DISCOVERY_FILTERS", "MODULE_GROUP", "DISPLAY_NAME", "USE_WILD_VALUE_AS_UUID", "DATAPOINT_ALERT_THRESHOLDS", "TAGS". |
| 133 | +"NAME" will preserve the name of the LogicModule. |
| 134 | +"APPLIES_TO_SCRIPT" will preserve the appliesToScript of the LogicModule. |
| 135 | +"COLLECTION_INTERVAL" will preserve the collectionInterval of the LogicModule. |
| 136 | +"ACTIVE_DISCOVERY_INTERVAL" will preserve the activeDiscoveryInterval of the LogicModule. |
| 137 | +"ACTIVE_DISCOVERY_FILTERS" will preserve the activeDiscoveryFilters of the LogicModule. |
| 138 | +"MODULE_GROUP" will preserve the moduleGroup of the LogicModule. |
| 139 | +"DISPLAY_NAME" will preserve the displayName of the LogicModule. |
| 140 | +"USE_WILD_VALUE_AS_UUID" will preserve the useWildValueAsUuid of the LogicModule. |
| 141 | +"DATAPOINT_ALERT_THRESHOLDS" will preserve the datapointAlertThresholds of the LogicModule. |
| 142 | +"TAGS" will preserve the tags of the LogicModule. |
| 143 | +
|
| 144 | +```yaml |
| 145 | +Type: String |
| 146 | +Parameter Sets: (All) |
| 147 | +Aliases: |
| 148 | + |
| 149 | +Required: False |
| 150 | +Position: Named |
| 151 | +Default value: None |
| 152 | +Accept pipeline input: False |
| 153 | +Accept wildcard characters: False |
| 154 | +``` |
| 155 | +
|
| 156 | +### -HandleConflict |
| 157 | +Optional. |
| 158 | +Specifies how to handle conflicts during import. |
| 159 | +Only applies to JSON imports. |
| 160 | +Defaults to "FORCE_OVERWRITE". |
| 161 | +Valid values are "FORCE_OVERWRITE" or "ERROR". |
| 162 | +"FORCE_OVERWRITE" will overwrite the existing LogicModule with the same name. |
| 163 | +"ERROR" will throw an error if a conflict is found. |
| 164 | +
|
| 165 | +```yaml |
| 166 | +Type: String |
| 167 | +Parameter Sets: (All) |
| 168 | +Aliases: |
| 169 | + |
| 170 | +Required: False |
| 171 | +Position: Named |
| 172 | +Default value: FORCE_OVERWRITE |
| 173 | +Accept pipeline input: False |
| 174 | +Accept wildcard characters: False |
| 175 | +``` |
| 176 | +
|
| 177 | +### -ProgressAction |
| 178 | +{{ Fill ProgressAction Description }} |
| 179 | +
|
| 180 | +```yaml |
| 181 | +Type: ActionPreference |
| 182 | +Parameter Sets: (All) |
| 183 | +Aliases: proga |
| 184 | + |
| 185 | +Required: False |
| 186 | +Position: Named |
| 187 | +Default value: None |
| 188 | +Accept pipeline input: False |
| 189 | +Accept wildcard characters: False |
| 190 | +``` |
| 191 | +
|
| 192 | +### CommonParameters |
| 193 | +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). |
| 194 | +
|
| 195 | +## INPUTS |
| 196 | +
|
| 197 | +### None. You cannot pipe objects to this command. |
| 198 | +## OUTPUTS |
| 199 | +
|
| 200 | +### Returns a success message if the import is successful. |
| 201 | +## NOTES |
| 202 | +You must run Connect-LMAccount before running this command. |
| 203 | +Requires PowerShell version 6.1 or higher. |
| 204 | +
|
| 205 | +Note: Some module types only support specific formats: |
| 206 | +- logsources, oids, functions, diagnosticsources: JSON only |
| 207 | +- Other types: Both XML and JSON supported |
| 208 | +
|
| 209 | +## RELATED LINKS |
0 commit comments