Export-LMDeviceData
Syntax
DeviceId
Export-LMDeviceData -DeviceId <Int32> [-StartDate <DateTime>] [-EndDate <DateTime>] [-DatasourceIncludeFilter <String>] [-DatasourceExcludeFilter <String>] [-ExportFormat <String>] [-ExportPath <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
DeviceDisplayName
Export-LMDeviceData -DeviceDisplayName <String> [-StartDate <DateTime>] [-EndDate <DateTime>] [-DatasourceIncludeFilter <String>] [-DatasourceExcludeFilter <String>] [-ExportFormat <String>] [-ExportPath <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
DeviceHostName
Export-LMDeviceData -DeviceHostName <String> [-StartDate <DateTime>] [-EndDate <DateTime>] [-DatasourceIncludeFilter <String>] [-DatasourceExcludeFilter <String>] [-ExportFormat <String>] [-ExportPath <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
DeviceGroupId
Export-LMDeviceData -DeviceGroupId <String> [-StartDate <DateTime>] [-EndDate <DateTime>] [-DatasourceIncludeFilter <String>] [-DatasourceExcludeFilter <String>] [-ExportFormat <String>] [-ExportPath <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
DeviceGroupName
Export-LMDeviceData -DeviceGroupName <String> [-StartDate <DateTime>] [-EndDate <DateTime>] [-DatasourceIncludeFilter <String>] [-DatasourceExcludeFilter <String>] [-ExportFormat <String>] [-ExportPath <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
Description
The Export-LMDeviceData function exports monitoring data from LogicMonitor devices or device groups. It supports exporting data for specific time ranges and can filter datasources. Data can be exported in CSV or JSON format.
Examples
Example 1
#Export device data to JSONExport-LMDeviceData -DeviceId 12345 -StartDate (Get-Date).AddDays(-1) -ExportFormat json
Example 2
#Export device group data to CSV with datasource filteringExport-LMDeviceData -DeviceGroupName "Production" -DatasourceIncludeFilter "CPU*" -ExportFormat csv
Parameters
-DeviceId
The ID of the device to export data from. This parameter is part of a mutually exclusive parameter set.
Type: Int32Parameter Sets: DeviceIdAliases:
Required: TruePosition: NamedDefault value: 0Accept pipeline input: FalseAccept wildcard characters: False
-DeviceDisplayName
The display name of the device to export data from. This parameter is part of a mutually exclusive parameter set.
Type: StringParameter Sets: DeviceDisplayNameAliases:
Required: TruePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False
-DeviceHostName
The hostname of the device to export data from. This parameter is part of a mutually exclusive parameter set.
Type: StringParameter Sets: DeviceHostNameAliases:
Required: TruePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False
-DeviceGroupId
The ID of the device group to export data from. This parameter is part of a mutually exclusive parameter set.
Type: StringParameter Sets: DeviceGroupIdAliases:
Required: TruePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False
-DeviceGroupName
The name of the device group to export data from. This parameter is part of a mutually exclusive parameter set.
Type: StringParameter Sets: DeviceGroupNameAliases:
Required: TruePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False
-StartDate
The start date and time for data collection. Defaults to 1 hour ago.
Type: DateTimeParameter Sets: (All)Aliases:
Required: FalsePosition: NamedDefault value: (Get-Date).AddHours(-1)Accept pipeline input: FalseAccept wildcard characters: False
-EndDate
The end date and time for data collection. Defaults to current time.
Type: DateTimeParameter Sets: (All)Aliases:
Required: FalsePosition: NamedDefault value: (Get-Date)Accept pipeline input: FalseAccept wildcard characters: False
-DatasourceIncludeFilter
A filter pattern to include specific datasources. Defaults to ”*” (all datasources).
Type: StringParameter Sets: (All)Aliases:
Required: FalsePosition: NamedDefault value: *Accept pipeline input: FalseAccept wildcard characters: False
-DatasourceExcludeFilter
A filter pattern to exclude specific datasources. Defaults to null (no exclusions).
Type: StringParameter Sets: (All)Aliases:
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False
-ExportFormat
The format for the exported data. Valid values are “csv”, “json”, or “none”. Defaults to “none”.
Type: StringParameter Sets: (All)Aliases:
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False
-ExportPath
The path where exported files will be saved. Defaults to current directory.
Type: StringParameter Sets: (All)Aliases:
Required: FalsePosition: NamedDefault value: (Get-Location).PathAccept pipeline input: FalseAccept wildcard characters: False
-ProgressAction
Fill ProgressAction Description
Type: ActionPreferenceParameter Sets: (All)Aliases: proga
Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False
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
None. You cannot pipe objects to this command.
Outputs
Returns device data objects if ExportFormat is “none”, otherwise creates export files.
Notes
You must run Connect-LMAccount before running this command.