New-LMDiagnosticSource
Syntax
Section titled “Syntax”Default (Default)
Section titled “Default (Default)”New-LMDiagnosticSource -Name <String> [-Description <String>] [-AppliesTo <String>] [-Technology <String>] [-Tags <String>] [-Group <String>] [-ScriptType <String>] [-GroovyScript <String>] [-AccessGroupIds <Int32[]>] [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]InputObject
Section titled “InputObject”New-LMDiagnosticSource -InputObject <PSObject> [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]Description
Section titled “Description”The New-LMDiagnosticSource function creates a new diagnostic source in LogicMonitor. You can specify individual parameters or provide a complete configuration object using the InputObject parameter.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”# Create a new diagnostic source using explicit parametersNew-LMDiagnosticSource -Name "MyDiagnosticSource" -Description "Checks service status" -ScriptType "powershell" -GroovyScript "Get-Service MyService"Example 2
Section titled “Example 2”# Create a new diagnostic source using an InputObject$config = @{ name = "MyDiagnosticSource" description = "Checks service status" scriptType = "powershell" groovyScript = "Get-Service MyService"}New-LMDiagnosticSource -InputObject $configParameters
Section titled “Parameters”-InputObject
Section titled “-InputObject”A PSCustomObject containing the complete diagnostic source configuration. Must follow the schema model defined in LogicMonitor’s API documentation. Use this parameter for advanced or programmatic scenarios.
Type: PSObjectParameter Sets: InputObjectAliases:
Required: TruePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: FalseThe name of the diagnostic source. This parameter is mandatory when using explicit parameters.
Type: StringParameter Sets: DefaultAliases:
Required: TruePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False-Description
Section titled “-Description”The description for the diagnostic source.
Type: StringParameter Sets: DefaultAliases:
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False-AppliesTo
Section titled “-AppliesTo”The AppliesTo expression for the diagnostic source.
Type: StringParameter Sets: DefaultAliases:
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False-Technology
Section titled “-Technology”The technical notes for the diagnostic source.
Type: StringParameter Sets: DefaultAliases:
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: FalseThe tags to associate with the diagnostic source.
Type: StringParameter Sets: DefaultAliases:
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False-Group
Section titled “-Group”The group the diagnostic source belongs to.
Type: StringParameter Sets: DefaultAliases:
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False-ScriptType
Section titled “-ScriptType”The script type for the diagnostic source. Valid values are ‘groovy’ or ‘powershell’. Defaults to ‘groovy’.
Type: StringParameter Sets: DefaultAliases:
Required: FalsePosition: NamedDefault value: GroovyAccept pipeline input: FalseAccept wildcard characters: False-GroovyScript
Section titled “-GroovyScript”The script content for the diagnostic source.
Type: StringParameter Sets: DefaultAliases:
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False-AccessGroupIds
Section titled “-AccessGroupIds”An array of Access Group IDs to assign to the diagnostic source.
Type: Int32[]Parameter Sets: DefaultAliases:
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False-WhatIf
Section titled “-WhatIf”Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: SwitchParameterParameter Sets: (All)Aliases: wi
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False-Confirm
Section titled “-Confirm”Prompts you for confirmation before running the cmdlet.
Type: SwitchParameterParameter Sets: (All)Aliases: cf
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False-ProgressAction
Section titled “-ProgressAction”Fill ProgressAction Description
Type: ActionPreferenceParameter Sets: (All)Aliases: proga
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: FalseCommonParameters
Section titled “CommonParameters”This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs
Section titled “Inputs”None. You cannot pipe objects to this command.
Section titled “None. You cannot pipe objects to this command.”Outputs
Section titled “Outputs”Returns LogicMonitor.DiagnosticSource object.
Section titled “Returns LogicMonitor.DiagnosticSource object.”You must run Connect-LMAccount before running this command. For diagnostic source schema details, see: https://www.logicmonitor.com/swagger-ui-master/api-v3/dist/#/DiagnosticSources/addDiagnosticSource