Skip to content

Commit 4e81ef1

Browse files
committed
6.5.2 update
1 parent d09268d commit 4e81ef1

File tree

8 files changed

+202
-17
lines changed

8 files changed

+202
-17
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
Function Get-LMNormalizedProperties {
2+
3+
[CmdletBinding()]
4+
Param ()
5+
6+
#Check if we are logged in and have valid api creds
7+
Begin {}
8+
Process {
9+
If ($Script:LMAuth.Valid) {
10+
11+
#Build header and uri
12+
$ResourcePath = "/normalizedProperties/filter"
13+
14+
$Body = [PSCustomObject]@{
15+
meta = @{
16+
filters = @{
17+
filterType = "FILTER_CATEGORICAL_MODEL_TYPE"
18+
normalizedProperties = @{
19+
dynamic = @(
20+
@{
21+
field = "alias"
22+
expressions = @(
23+
@{
24+
operator = "REGEX"
25+
value = ".*"
26+
}
27+
)
28+
}
29+
)
30+
}
31+
}
32+
paging = @{
33+
perPageCount = 100
34+
pageOffsetCount = 0
35+
}
36+
sort = "alias, hostPropertyPriority"
37+
}
38+
} | ConvertTo-Json -Depth 10
39+
40+
Try {
41+
$Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Version 4
42+
$Uri = "https://$($Script:LMAuth.Portal).logicmonitor.com/santaba/rest" + $ResourcePath
43+
44+
Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation
45+
46+
#Issue request
47+
$Response = Invoke-RestMethod -Uri $Uri -Method "POST" -Headers $Headers[0] -WebSession $Headers[1] -Body $Body
48+
}
49+
Catch [Exception] {
50+
$Proceed = Resolve-LMException -LMException $PSItem
51+
If (!$Proceed) {
52+
Return
53+
}
54+
}
55+
Return $Response
56+
}
57+
Else {
58+
Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again."
59+
}
60+
}
61+
End {}
62+
}

Public/New-LMDevice.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ Function New-LMDevice {
141141
#Remove empty keys so we dont overwrite them
142142
@($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } }
143143

144-
$Data = ($Data | ConvertTo-Json)
144+
$Data = ($Data | ConvertTo-Json -Depth 5)
145145
$Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data
146146
$Uri = "https://$($Script:LMAuth.Portal).logicmonitor.com/santaba/rest" + $ResourcePath
147147

Public/New-LMNetscan.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ Function New-LMNetScan {
159159
#Remove empty keys so we dont overwrite them
160160
@($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } }
161161

162-
$Data = ($Data | ConvertTo-Json)
162+
$Data = ($Data | ConvertTo-Json -Depth 5)
163163
$Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data
164164
$Uri = "https://$($Script:LMAuth.Portal).logicmonitor.com/santaba/rest" + $ResourcePath
165165

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
Function New-LMNormalizedProperties {
2+
3+
[CmdletBinding()]
4+
Param (
5+
[Parameter(Mandatory = $true)]
6+
[String]$Alias,
7+
[Parameter(Mandatory = $true)]
8+
[Array]$Properties
9+
)
10+
11+
#Check if we are logged in and have valid api creds
12+
Begin {}
13+
Process {
14+
If ($Script:LMAuth.Valid) {
15+
16+
#Build header and uri
17+
$ResourcePath = "/normalizedProperties/bulk"
18+
19+
#Loop through each property and build the body
20+
$Body = [PSCustomObject]@{
21+
data = [PSCustomObject]@{
22+
items = @()
23+
}
24+
}
25+
$Index = 1
26+
ForEach ($Property in $Properties) {
27+
$Body.data.items += [PSCustomObject]@{
28+
alias = $Alias
29+
hostProperty = $Property
30+
hostPropertyPriority = $Index
31+
model = "normalizedProperties"
32+
}
33+
$Index++
34+
}
35+
36+
$Body = $Body | ConvertTo-Json -Depth 10
37+
38+
Try {
39+
$Headers = New-LMHeader -Auth $Script:LMAuth -Method "PATCH" -ResourcePath $ResourcePath -Version 4
40+
$Uri = "https://$($Script:LMAuth.Portal).logicmonitor.com/santaba/rest" + $ResourcePath
41+
42+
Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation
43+
44+
#Issue request
45+
$Response = Invoke-RestMethod -Uri $Uri -Method "PATCH" -Headers $Headers[0] -WebSession $Headers[1] -Body $Body
46+
}
47+
Catch [Exception] {
48+
$Proceed = Resolve-LMException -LMException $PSItem
49+
If (!$Proceed) {
50+
Return
51+
}
52+
}
53+
Return $Response
54+
}
55+
Else {
56+
Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again."
57+
}
58+
}
59+
End {}
60+
}

Public/New-LMUser.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ Function New-LMUser {
199199
#Remove empty keys so we dont overwrite them
200200
@($Data.keys) | ForEach-Object { If ([string]::IsNullOrEmpty($Data[$_])) { $Data.Remove($_) } }
201201

202-
$Data = ($Data | ConvertTo-Json)
202+
$Data = ($Data | ConvertTo-Json -Depth 5)
203203

204204
$Headers = New-LMHeader -Auth $Script:LMAuth -Method "POST" -ResourcePath $ResourcePath -Data $Data
205205
$Uri = "https://$($Script:LMAuth.Portal).logicmonitor.com/santaba/rest" + $ResourcePath
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
Function Remove-LMNormalizedProperties {
2+
3+
[CmdletBinding()]
4+
Param (
5+
[Parameter(Mandatory = $true)]
6+
[String]$Alias
7+
)
8+
9+
#Check if we are logged in and have valid api creds
10+
Begin {}
11+
Process {
12+
If ($Script:LMAuth.Valid) {
13+
14+
#Build header and uri
15+
$ResourcePath = "/normalizedProperties/alias"
16+
17+
#Loop through each property and build the body
18+
$Body = [PSCustomObject]@{
19+
data = [PSCustomObject]@{
20+
items = @()
21+
}
22+
}
23+
24+
$Body.data.items += [PSCustomObject]@{
25+
alias = $Alias
26+
model = "normalizedProperties"
27+
}
28+
29+
$Body = $Body | ConvertTo-Json -Depth 10
30+
31+
Try {
32+
$Headers = New-LMHeader -Auth $Script:LMAuth -Method "DELETE" -ResourcePath $ResourcePath -Version 4
33+
$Uri = "https://$($Script:LMAuth.Portal).logicmonitor.com/santaba/rest" + $ResourcePath
34+
35+
Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation
36+
37+
#Issue request
38+
$Response = Invoke-RestMethod -Uri $Uri -Method "DELETE" -Headers $Headers[0] -WebSession $Headers[1] -Body $Body
39+
}
40+
Catch [Exception] {
41+
$Proceed = Resolve-LMException -LMException $PSItem
42+
If (!$Proceed) {
43+
Return
44+
}
45+
}
46+
Return $Response
47+
}
48+
Else {
49+
Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again."
50+
}
51+
}
52+
End {}
53+
}

README.md

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -427,24 +427,16 @@ This change aims to enhance visibility within the community and to foster a more
427427

428428
We appreciate your continued support and enthusiasm for the Logic.Monitor PowerShell module. Your contributions and feedback are vital to the success of this project, and we look forward to seeing how the module evolves with your participation.
429429

430-
## 6.5.1
430+
## 6.5.2
431431
### Bug Fixes
432-
- Fixed a bug that caused Informational console logs from being displayed. Cmdlets that previously on output status messages to the console should once again produce output as informational stream data.
432+
- Fixed a bug the prevented certain size json objects from being sent to the LM API due to the default depth of 2 being too small.
433433

434-
435-
## 6.5
436-
### Module Updates/Changes
437-
- **Set-LMDeviceDatasourceInstance**: Added `-PropertiesMethod` parameter to control property update behavior. Defaults to "Replace" to match other property-related cmdlets.
438-
- **Copy-LMDashboard**: Added `-DashboardTokens` parameter (hashtable) to override tokens when cloning dashboards.
439-
- **Copy-Report**: Now accepts a report object as a template for cloning. This enables customization of properties, resource scope, and other parameters before creating the copy.
440-
- **New-LMNetScan** and **Set-LMNetScan**: Added `-Schedule` parameter that accepts a PSCustomObject to define scan scheduling. Maintains default manual scheduling when parameter is omitted.
441-
442434
### New Cmdlets
443-
- **Remove-LMDeviceGroupProperty**: Enables removal of device properties at the resource group level.
444-
445-
### Bug Fixes
446-
- **Set-LMCollectorConfig**: Resolved an issue where similar configuration paths could cause unintended multiple updates.
435+
- **New-LMNormalizedProperties**: Added cmdlet to create normalized properties.
436+
- **Remove-LMNormalizedProperties**: Added cmdlet to remove normalized properties.
437+
- **Get-LMNormalizedProperties**: Added cmdlet to get normalized properties.
447438

439+
**Note**: The normalized properties cmdlets are currently only supported for the v4 API and are not supported in the v3 API currently, they are being added to the module as a preview feature for select users until the v3 API is updated to support them in which case the cmdlets will be updated to support the v3 API and available to all users.
448440

449441
[Previous Release Notes](RELEASENOTES.md)
450442

RELEASENOTES.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
11
# Previous module release notes
2+
## 6.5.1
3+
### Bug Fixes
4+
- Fixed a bug that caused Informational console logs from being displayed. Cmdlets that previously on output status messages to the console should once again produce output as informational stream data.
5+
6+
7+
## 6.5
8+
### Module Updates/Changes
9+
- **Set-LMDeviceDatasourceInstance**: Added `-PropertiesMethod` parameter to control property update behavior. Defaults to "Replace" to match other property-related cmdlets.
10+
- **Copy-LMDashboard**: Added `-DashboardTokens` parameter (hashtable) to override tokens when cloning dashboards.
11+
- **Copy-Report**: Now accepts a report object as a template for cloning. This enables customization of properties, resource scope, and other parameters before creating the copy.
12+
- **New-LMNetScan** and **Set-LMNetScan**: Added `-Schedule` parameter that accepts a PSCustomObject to define scan scheduling. Maintains default manual scheduling when parameter is omitted.
13+
14+
### New Cmdlets
15+
- **Remove-LMDeviceGroupProperty**: Enables removal of device properties at the resource group level.
16+
17+
### Bug Fixes
18+
- **Set-LMCollectorConfig**: Resolved an issue where similar configuration paths could cause unintended multiple updates.
19+
220
## 6.4.1
321
### Module Updates/Changes
422
- **Write-LMHost** has been removed entirely starting in this version and replaced with native Write-Information,Warning and Error cmdlets. If you would like to suppress the output of these cmdlets you can use the *\$InformationPreference*, *\$DebugPreference* and *\$WarningPreference* variables. Additionally you can use the *-DisableConsoleLogging* switch on Connect-LMAccount to suppress Write-Information output.

0 commit comments

Comments
 (0)