Skip to content

Commit 46fd149

Browse files
committed
Prep release
1 parent 3dfc7bd commit 46fd149

11 files changed

+458
-34
lines changed

Public/Get-LMDeviceDataSourceList.ps1

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,64 @@
1+
<#
2+
.SYNOPSIS
3+
Retrieves a list of device data sources from LogicMonitor.
4+
5+
.DESCRIPTION
6+
The Get-LMDeviceDatasourceList function retrieves a list of device data sources from LogicMonitor based on the specified parameters. It supports filtering by device ID or device name, and allows customization of the batch size for pagination.
7+
8+
.PARAMETER Id
9+
Specifies the ID of the device for which to retrieve the data sources. This parameter is mandatory when using the 'Id' parameter set.
10+
11+
.PARAMETER Name
12+
Specifies the name of the device for which to retrieve the data sources. This parameter is mandatory when using the 'Name' parameter set.
13+
14+
.PARAMETER Filter
15+
Specifies additional filters to apply to the data sources. This parameter accepts an object representing the filter criteria.
16+
17+
.PARAMETER BatchSize
18+
Specifies the number of data sources to retrieve per batch. The default value is 1000.
19+
20+
.EXAMPLE
21+
Get-LMDeviceDatasourceList -Id 1234
22+
Retrieves the data sources for the device with ID 1234.
23+
24+
.EXAMPLE
25+
Get-LMDeviceDatasourceList -Name "MyDevice"
26+
Retrieves the data sources for the device with the name "MyDevice".
27+
28+
.EXAMPLE
29+
Get-LMDeviceDatasourceList -Filter "Property -eq 'Value'"
30+
Retrieves the data sources that match the specified filter criteria.
31+
32+
#>
33+
Function Get-LMDeviceDatasourceList {
34+
[CmdletBinding(DefaultParameterSetName = 'Id')]
35+
Param (
36+
[Parameter(Mandatory, ParameterSetName = 'Id')]
37+
[Alias('DeviceId')]
38+
[Int]$Id,
39+
40+
[Parameter(ParameterSetName = 'Name')]
41+
[Alias('DeviceName')]
42+
[String]$Name,
43+
44+
[Object]$Filter,
45+
46+
[ValidateRange(1, 1000)]
47+
[Int]$BatchSize = 1000
48+
)
49+
# Rest of the code...
50+
}
51+
152
Function Get-LMDeviceDatasourceList {
253

354
[CmdletBinding(DefaultParameterSetName = 'Id')]
455
Param (
556
[Parameter(Mandatory, ParameterSetName = 'Id')]
57+
[Alias('DeviceId')]
658
[Int]$Id,
759

860
[Parameter(ParameterSetName = 'Name')]
61+
[Alias('DeviceName')]
962
[String]$Name,
1063

1164
[Object]$Filter,

Public/Get-LMDeviceDatasourceInstance.ps1

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,39 @@
1+
<#
2+
.SYNOPSIS
3+
Retrieves instances of a LogicMonitor device datasource.
4+
5+
.DESCRIPTION
6+
The Get-LMDeviceDatasourceInstance function retrieves instances of a LogicMonitor device datasource based on the specified parameters. It requires a valid API authentication and authorization.
7+
8+
.PARAMETER DatasourceName
9+
Specifies the name of the datasource. This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter sets.
10+
11+
.PARAMETER DatasourceId
12+
Specifies the ID of the datasource. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter sets.
13+
14+
.PARAMETER Id
15+
Specifies the ID of the device. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter sets. It can also be specified using the 'DeviceId' alias.
16+
17+
.PARAMETER Name
18+
Specifies the name of the device. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. It can also be specified using the 'DeviceName' alias.
19+
20+
.PARAMETER Filter
21+
Specifies additional filters to apply to the instances. This parameter accepts an object representing the filter criteria.
22+
23+
.PARAMETER BatchSize
24+
Specifies the number of instances to retrieve per batch. The default value is 1000.
25+
26+
.EXAMPLE
27+
Get-LMDeviceDatasourceInstance -DatasourceName "CPU" -Name "Server01" -BatchSize 500
28+
Retrieves instances of the "CPU" datasource for the device named "Server01" with a batch size of 500.
29+
30+
.EXAMPLE
31+
Get-LMDeviceDatasourceInstance -DatasourceId 1234 -Id 5678
32+
Retrieves instances of the datasource with ID 1234 for the device with ID 5678.
33+
34+
.NOTES
35+
This function requires a valid API authentication and authorization. Use Connect-LMAccount to log in before running any commands.
36+
#>
137
Function Get-LMDeviceDatasourceInstance {
238

339
[CmdletBinding()]
@@ -12,13 +48,13 @@ Function Get-LMDeviceDatasourceInstance {
1248

1349
[Parameter(Mandatory, ParameterSetName = 'Id-dsId')]
1450
[Parameter(Mandatory, ParameterSetName = 'Id-dsName')]
15-
[Alias("Id")]
16-
[Int]$DeviceId,
51+
[Alias("DeviceId")]
52+
[Int]$Id,
1753

1854
[Parameter(Mandatory, ParameterSetName = 'Name-dsName')]
1955
[Parameter(Mandatory, ParameterSetName = 'Name-dsId')]
20-
[Alias("Name")]
21-
[String]$DeviceName,
56+
[Alias("DeviceName")]
57+
[String]$Name,
2258

2359
[Object]$Filter,
2460

@@ -30,25 +66,25 @@ Function Get-LMDeviceDatasourceInstance {
3066
If ($Script:LMAuth.Valid) {
3167

3268
#Lookup Device Id
33-
If ($DeviceName) {
34-
$LookupResult = (Get-LMDevice -Name $DeviceName).Id
35-
If (Test-LookupResult -Result $LookupResult -LookupString $DeviceName) {
69+
If ($Name) {
70+
$LookupResult = (Get-LMDevice -Name $Name).Id
71+
If (Test-LookupResult -Result $LookupResult -LookupString $Name) {
3672
return
3773
}
38-
$DeviceId = $LookupResult
74+
$Id = $LookupResult
3975
}
4076

4177
#Lookup DatasourceId
4278
If ($DatasourceName -or $DatasourceId) {
43-
$LookupResult = (Get-LMDeviceDataSourceList -Id $DeviceId | Where-Object { $_.dataSourceName -eq $DatasourceName -or $_.dataSourceId -eq $DatasourceId }).Id
79+
$LookupResult = (Get-LMDeviceDataSourceList -Id $Id | Where-Object { $_.dataSourceName -eq $DatasourceName -or $_.dataSourceId -eq $DatasourceId }).Id
4480
If (Test-LookupResult -Result $LookupResult -LookupString $DatasourceName) {
4581
return
4682
}
4783
$HdsId = $LookupResult
4884
}
4985

5086
#Build header and uri
51-
$ResourcePath = "/device/devices/$DeviceId/devicedatasources/$HdsId/instances"
87+
$ResourcePath = "/device/devices/$Id/devicedatasources/$HdsId/instances"
5288

5389
#Initalize vars
5490
$QueryParams = ""

Public/Get-LMDeviceDatasourceInstanceAlertRecipients.ps1

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,40 @@
1-
Function Get-LMDeviceDatasourceInstanceAlertRecipients {
1+
<#
2+
.SYNOPSIS
3+
Retrieves the alert recipients for a specific data point in a LogicMonitor device datasource instance.
4+
5+
.DESCRIPTION
6+
The Get-LMDeviceDatasourceInstanceAlertRecipients function retrieves the alert recipients for a specific data point in a LogicMonitor device datasource instance. It requires valid API credentials and a logged-in session.
7+
8+
.PARAMETER DatasourceName
9+
Specifies the name of the datasource. This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter sets.
10+
11+
.PARAMETER DatasourceId
12+
Specifies the ID of the datasource. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter sets.
13+
14+
.PARAMETER Id
15+
Specifies the ID of the device. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter sets. It can also be specified using the 'DeviceId' alias.
16+
17+
.PARAMETER Name
18+
Specifies the name of the device. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter sets. It can also be specified using the 'DeviceName' alias.
19+
20+
.PARAMETER InstanceName
21+
Specifies the name of the datasource instance. This parameter is mandatory.
222
23+
.PARAMETER DataPointName
24+
Specifies the name of the data point. This parameter is mandatory.
25+
26+
.EXAMPLE
27+
Get-LMDeviceDatasourceInstanceAlertRecipients -DatasourceName "Ping-" -Name "Server01" -InstanceName "Instance01" -DataPointName "PingLossPercent"
28+
29+
Retrieves the alert recipients for the "PingLossPercent" data point in the "CPU" datasource instance of the "Server01" device.
30+
31+
.EXAMPLE
32+
Get-LMDeviceDatasourceInstanceAlertRecipients -DatasourceId 123 -Id 456 -InstanceName "Instance01" -DataPointName "PingLossPercent"
33+
34+
Retrieves the alert recipients for the "PingLossPercent" data point in the datasource instance with ID 123 of the device with ID 456.
35+
36+
#>
37+
Function Get-LMDeviceDatasourceInstanceAlertRecipients {
338
[CmdletBinding()]
439
Param (
540
[Parameter(Mandatory, ParameterSetName = 'Id-dsName')]
@@ -12,10 +47,12 @@ Function Get-LMDeviceDatasourceInstanceAlertRecipients {
1247

1348
[Parameter(Mandatory, ParameterSetName = 'Id-dsId')]
1449
[Parameter(Mandatory, ParameterSetName = 'Id-dsName')]
50+
[Alias('DeviceId')]
1551
[Int]$Id,
1652

1753
[Parameter(Mandatory, ParameterSetName = 'Name-dsName')]
1854
[Parameter(Mandatory, ParameterSetName = 'Name-dsId')]
55+
[Alias('DeviceName')]
1956
[String]$Name,
2057

2158
[Parameter(Mandatory)]

Public/Get-LMDeviceDatasourceInstanceAlertSetting.ps1

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,43 @@
1+
<#
2+
.SYNOPSIS
3+
Retrieves the alert settings for a specific LogicMonitor device datasource instance.
4+
5+
.DESCRIPTION
6+
The Get-LMDeviceDatasourceInstanceAlertSetting function retrieves the alert settings for a specific LogicMonitor device datasource instance. It requires the device name or ID, datasource name or ID, and instance name as input parameters. Optionally, you can also provide a filter to narrow down the results. The function returns an array of alert settings for the specified instance.
7+
8+
.PARAMETER DatasourceName
9+
Specifies the name of the datasource. This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter set.
10+
11+
.PARAMETER DatasourceId
12+
Specifies the ID of the datasource. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter set.
13+
14+
.PARAMETER Id
15+
Specifies the ID of the device. This parameter is mandatory when using the 'Id-dsId' or 'Id-dsName' parameter set. This parameter can also be specified using the 'DeviceId' alias.
16+
17+
.PARAMETER Name
18+
Specifies the name of the device. This parameter is mandatory when using the 'Name-dsName' or 'Name-dsId' parameter set. This parameter can also be specified using the 'DeviceName' alias.
19+
20+
.PARAMETER InstanceName
21+
Specifies the name of the instance for which to retrieve the alert settings. This parameter is mandatory.
22+
23+
.PARAMETER Filter
24+
Specifies a filter to narrow down the results. This parameter is optional.
25+
26+
.PARAMETER BatchSize
27+
Specifies the number of results to retrieve per batch. The default value is 1000. This parameter is optional.
28+
29+
.EXAMPLE
30+
Get-LMDeviceDatasourceInstanceAlertSetting -Name "MyDevice" -DatasourceName "MyDatasource" -InstanceName "MyInstance"
31+
Retrieves the alert settings for the instance named "MyInstance" of the datasource "MyDatasource" on the device named "MyDevice".
32+
33+
.EXAMPLE
34+
Get-LMDeviceDatasourceInstanceAlertSetting -Id 123 -DatasourceId 456 -InstanceName "MyInstance" -Filter "Property -eq 'value'"
35+
Retrieves the alert settings for the instance named "MyInstance" of the datasource with ID 456 on the device with ID 123, applying the specified filter.
36+
37+
.NOTES
38+
This function requires a valid LogicMonitor API authentication. Make sure you are logged in before running any commands by using the Connect-LMAccount function.
39+
#>
40+
141
Function Get-LMDeviceDatasourceInstanceAlertSetting {
242

343
[CmdletBinding()]
@@ -12,10 +52,12 @@ Function Get-LMDeviceDatasourceInstanceAlertSetting {
1252

1353
[Parameter(Mandatory, ParameterSetName = 'Id-dsId')]
1454
[Parameter(Mandatory, ParameterSetName = 'Id-dsName')]
55+
[Alias('DeviceId')]
1556
[Int]$Id,
1657

1758
[Parameter(Mandatory, ParameterSetName = 'Name-dsName')]
1859
[Parameter(Mandatory, ParameterSetName = 'Name-dsId')]
60+
[Alias('DeviceName')]
1961
[String]$Name,
2062

2163
[Parameter(Mandatory)]

Public/Get-LMDeviceDatasourceInstanceGroup.ps1

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,45 @@
1+
<#
2+
.SYNOPSIS
3+
Retrieves the instance groups associated with a LogicMonitor device datasource.
4+
5+
.DESCRIPTION
6+
The Get-LMDeviceDatasourceInstanceGroup function retrieves the instance groups associated with a LogicMonitor device datasource. It requires valid API credentials and a logged-in session.
7+
8+
.PARAMETER DatasourceName
9+
Specifies the name of the datasource. This parameter is mandatory when using the 'Id-dsName' or 'Name-dsName' parameter sets.
10+
11+
.PARAMETER DatasourceId
12+
Specifies the ID of the datasource. This parameter is mandatory when using the 'Id-dsId' or 'Name-dsId' parameter sets.
13+
14+
.PARAMETER Id
15+
Specifies the ID of the device. This parameter is mandatory when using the 'Id-dsId', 'Id-dsName', or 'Id-HdsId' parameter sets. This parameter is also aliased as 'DeviceId'.
16+
17+
.PARAMETER Name
18+
Specifies the name of the device. This parameter is mandatory when using the 'Name-dsName', 'Name-dsId', or 'Name-HdsId' parameter sets. This parameter is also aliased as 'DeviceName'.
19+
20+
.PARAMETER HdsId
21+
Specifies the ID of the device datasource. This parameter is mandatory when using the 'Id-HdsId' or 'Name-HdsId' parameter sets.
22+
23+
.PARAMETER Filter
24+
Specifies an optional filter to apply to the results.
25+
26+
.PARAMETER BatchSize
27+
Specifies the number of results to retrieve per batch. The default value is 1000.
28+
29+
.EXAMPLE
30+
Get-LMDeviceDatasourceInstanceGroup -DatasourceName "CPU" -Name "Server01"
31+
Retrieves the instance groups associated with the "CPU" datasource on the device named "Server01".
32+
33+
.EXAMPLE
34+
Get-LMDeviceDatasourceInstanceGroup -DatasourceId 123 -Id 456
35+
Retrieves the instance groups associated with the datasource with ID 123 on the device with ID 456.
36+
37+
#>
38+
39+
Function Get-LMDeviceDatasourceInstanceGroup {
40+
...
41+
}
42+
143
Function Get-LMDeviceDatasourceInstanceGroup {
244

345
[CmdletBinding()]
@@ -13,11 +55,13 @@ Function Get-LMDeviceDatasourceInstanceGroup {
1355
[Parameter(Mandatory, ParameterSetName = 'Id-dsId')]
1456
[Parameter(Mandatory, ParameterSetName = 'Id-dsName')]
1557
[Parameter(Mandatory, ParameterSetName = 'Id-HdsId')]
58+
[Alias('DeviceId')]
1659
[Int]$Id,
1760

1861
[Parameter(Mandatory, ParameterSetName = 'Name-dsName')]
1962
[Parameter(Mandatory, ParameterSetName = 'Name-dsId')]
2063
[Parameter(Mandatory, ParameterSetName = 'Name-HdsId')]
64+
[Alias('DeviceName')]
2165
[String]$Name,
2266

2367
[Parameter(Mandatory, ParameterSetName = 'Id-HdsId')]

Public/New-LMDeviceDatasourceInstance.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,12 @@ Function New-LMDeviceDatasourceInstance {
8181

8282
[Parameter(Mandatory, ParameterSetName = 'Id-dsId')]
8383
[Parameter(Mandatory, ParameterSetName = 'Id-dsName')]
84+
[Alias('DeviceId')]
8485
[Int]$Id,
8586

8687
[Parameter(Mandatory, ParameterSetName = 'Name-dsName')]
8788
[Parameter(Mandatory, ParameterSetName = 'Name-dsId')]
89+
[Alias('DeviceName')]
8890
[String]$Name
8991

9092
)

Public/New-LMDeviceDatasourceInstanceGroup.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,12 @@ Function New-LMDeviceDatasourceInstanceGroup {
5151

5252
[Parameter(Mandatory, ParameterSetName = 'Id-dsId')]
5353
[Parameter(Mandatory, ParameterSetName = 'Id-dsName')]
54+
[Alias('DeviceId')]
5455
[Int]$Id,
5556

5657
[Parameter(Mandatory, ParameterSetName = 'Name-dsName')]
5758
[Parameter(Mandatory, ParameterSetName = 'Name-dsId')]
59+
[Alias('DeviceName')]
5860
[String]$Name
5961

6062
)

0 commit comments

Comments
 (0)