Skip to content

Commit a919d54

Browse files
committed
realease 6.5.7
1 parent a490037 commit a919d54

File tree

6 files changed

+165
-18
lines changed

6 files changed

+165
-18
lines changed

Logic.Monitor.Format.ps1xml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,47 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Configuration>
33
<ViewDefinitions>
4+
<!-- New View LogicMonitor.SysOIDMap-->
5+
<View>
6+
<Name>LogicMonitorSysOIDMap</Name>
7+
<ViewSelectedBy>
8+
<TypeName>LogicMonitor.SysOIDMap</TypeName>
9+
</ViewSelectedBy>
10+
<TableControl>
11+
<TableHeaders>
12+
<TableColumnHeader>
13+
<Label>id</Label>
14+
</TableColumnHeader>
15+
<TableColumnHeader>
16+
<Label>name</Label>
17+
</TableColumnHeader>
18+
<TableColumnHeader>
19+
<Label>description</Label>
20+
</TableColumnHeader>
21+
<TableColumnHeader>
22+
<Label>code</Label>
23+
</TableColumnHeader>
24+
</TableHeaders>
25+
<TableRowEntries>
26+
<TableRowEntry>
27+
<TableColumnItems>
28+
<TableColumnItem>
29+
<PropertyName>id</PropertyName>
30+
</TableColumnItem>
31+
<TableColumnItem>
32+
<PropertyName>name</PropertyName>
33+
</TableColumnItem>
34+
<TableColumnItem>
35+
<PropertyName>description</PropertyName>
36+
</TableColumnItem>
37+
<TableColumnItem>
38+
<PropertyName>code</PropertyName>
39+
</TableColumnItem>
40+
</TableColumnItems>
41+
</TableRowEntry>
42+
</TableRowEntries>
43+
</TableControl>
44+
</View>
445
<!-- New View LogicMonitor.LMLogs-->
546
<View>
647
<Name>LogicMonitorLMLogs</Name>

Public/Get-LMSysOIDMap.ps1

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
Function Get-LMSysOIDMap {
2+
3+
[CmdletBinding(DefaultParameterSetName = 'All')]
4+
Param (
5+
[Parameter(ParameterSetName = 'Id')]
6+
[Int]$Id,
7+
8+
[Parameter(ParameterSetName = 'Name')]
9+
[String]$Name,
10+
11+
[Parameter(ParameterSetName = 'Filter')]
12+
[Object]$Filter,
13+
14+
[ValidateRange(1, 1000)]
15+
[Int]$BatchSize = 1000
16+
)
17+
#Check if we are logged in and have valid api creds
18+
If ($Script:LMAuth.Valid) {
19+
20+
#Build header and uri
21+
$ResourcePath = "/setting/functions"
22+
23+
#Initalize vars
24+
$QueryParams = ""
25+
$Count = 0
26+
$Done = $false
27+
$Results = @()
28+
29+
#Loop through requests
30+
While (!$Done) {
31+
#Build query params
32+
Switch ($PSCmdlet.ParameterSetName) {
33+
"All" { $QueryParams = "?size=$BatchSize&offset=$Count&sort=+id" }
34+
"Id" { $resourcePath += "/$Id" }
35+
"Name" { $QueryParams = "?filter=name:`"$Name`"&size=$BatchSize&offset=$Count&sort=+id" }
36+
"Filter" {
37+
#List of allowed filter props
38+
$PropList = @()
39+
$ValidFilter = Format-LMFilter -Filter $Filter -PropList $PropList
40+
$QueryParams = "?filter=$ValidFilter&size=$BatchSize&offset=$Count&sort=+id"
41+
}
42+
}
43+
Try {
44+
$Headers = New-LMHeader -Auth $Script:LMAuth -Method "GET" -ResourcePath $ResourcePath
45+
$Uri = "https://$($Script:LMAuth.Portal).logicmonitor.com/santaba/rest" + $ResourcePath + $QueryParams
46+
47+
48+
49+
Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation
50+
51+
#Issue request
52+
$Response = Invoke-RestMethod -Uri $Uri -Method "GET" -Headers $Headers[0] -WebSession $Headers[1]
53+
54+
#Stop looping if single device, no need to continue
55+
If ($PSCmdlet.ParameterSetName -eq "Id") {
56+
$Done = $true
57+
Return (Add-ObjectTypeInfo -InputObject $Response -TypeName "LogicMonitor.SysOIDMap")
58+
}
59+
#Check result size and if needed loop again
60+
Else {
61+
[Int]$Total = $Response.Total
62+
[Int]$Count += ($Response.Items | Measure-Object).Count
63+
$Results += $Response.Items
64+
If ($Count -ge $Total) {
65+
$Done = $true
66+
}
67+
}
68+
}
69+
Catch [Exception] {
70+
$Proceed = Resolve-LMException -LMException $PSItem
71+
If (!$Proceed) {
72+
Return
73+
}
74+
}
75+
}
76+
Return (Add-ObjectTypeInfo -InputObject $Results -TypeName "LogicMonitor.SysOIDMap")
77+
}
78+
Else {
79+
Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again."
80+
}
81+
}

Public/New-LMNormalizedProperties.ps1

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Function New-LMNormalizedProperties {
6161
$Headers = New-LMHeader -Auth $Script:LMAuth -Method "PATCH" -ResourcePath $ResourcePath -Version 4
6262
$Uri = "https://$($Script:LMAuth.Portal).logicmonitor.com/santaba/rest" + $ResourcePath
6363

64-
Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation
64+
Resolve-LMDebugInfo -Url $Uri -Headers $Headers[0] -Command $MyInvocation -Payload $Body
6565

6666
#Issue request
6767
$Response = Invoke-RestMethod -Uri $Uri -Method "PATCH" -Headers $Headers[0] -WebSession $Headers[1] -Body $Body
@@ -72,7 +72,22 @@ Function New-LMNormalizedProperties {
7272
Return
7373
}
7474
}
75-
Return $Response
75+
76+
# Transform the response to return just the normalized property values
77+
if ($Response.data.byId.normalizedProperties) {
78+
$normalizedProperties = $Response.data.byId.normalizedProperties
79+
$transformedProperties = @()
80+
81+
# Get all property names and sort them numerically
82+
$propertyNames = $normalizedProperties.PSObject.Properties.Name | Sort-Object { [int]$_ }
83+
84+
# Add each property's value to the array
85+
foreach ($propName in $propertyNames) {
86+
$transformedProperties += $normalizedProperties.$propName
87+
}
88+
89+
Return (Add-ObjectTypeInfo -InputObject $transformedProperties -TypeName "LogicMonitor.NormalizedProperties" )
90+
}
7691
}
7792
Else {
7893
Write-Error "Please ensure you are logged in before running any commands, use Connect-LMAccount to login and try again."

Public/Set-LMNormalizedProperties.ps1

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,14 @@ Function Set-LMNormalizedProperties {
115115
}
116116
}
117117
else {
118-
# For other aliases, only include id and model
119-
$Body.data.items += [PSCustomObject]@{
120-
id = $prop.id
121-
model = "normalizedProperties"
118+
if ($prop.isEditable) {
119+
# For other aliases, only include id and model
120+
$Body.data.items += [PSCustomObject]@{
121+
id = $prop.id
122+
model = "normalizedProperties"
123+
}
122124
}
125+
123126
}
124127
}
125128

README.md

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -431,20 +431,12 @@ This change aims to enhance visibility within the community and to foster a more
431431

432432
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.
433433

434-
## 6.5.6
435-
### New Cmdlets:
436-
- **Set-LMNormalizedProperties**: Allows updating of existing normalized properties.
437-
438-
```
439-
#Add new properties to an existing alias
440-
Set-LMNormalizedProperties -Add -Alias "location" -Properties @("location", "snmp.sysLocation", "auto.meraki.location")
441-
442-
#Remove a property from existing alias
443-
Set-LMNormalizedProperties -Remove -Alias "location" -Properties @("auto.meraki.location")
444-
```
445-
434+
## 6.5.7
446435
### Updated Cmdlets:
436+
- **Get-LMSysOIDMap**: Added cmdlet to query and retrieve sysOIDMap details.
447437
- **Get-LMNormalizedProperties**: Updated the output object type to make the returned object easier to work with. Returned object now contains the following fields: id,model,alias,hostProperty,hostPropertyPriority,isEditable,isDeletable
438+
- **New-LMNormalizedProperties**: Updated the output object type to make the returned object easier to work with. Returned object now contains the following fields: id,model,alias,hostProperty,hostPropertyPriority,isEditable,isDeletable
439+
- **Set-LMNormalizedProperties**: Fixed bug that caused new properties to fail to create.
448440

449441

450442
[Previous Release Notes](RELEASENOTES.md)

RELEASENOTES.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
# Previous module release notes
2+
## 6.5.6
3+
### New Cmdlets:
4+
- **Set-LMNormalizedProperties**: Allows updating of existing normalized properties.
5+
6+
```
7+
#Add new properties to an existing alias
8+
Set-LMNormalizedProperties -Add -Alias "location" -Properties @("location", "snmp.sysLocation", "auto.meraki.location")
9+
10+
#Remove a property from existing alias
11+
Set-LMNormalizedProperties -Remove -Alias "location" -Properties @("auto.meraki.location")
12+
```
13+
14+
### Updated Cmdlets:
15+
- **Get-LMNormalizedProperties**: Updated the output object type to make the returned object easier to work with. Returned object now contains the following fields: id,model,alias,hostProperty,hostPropertyPriority,isEditable,isDeletable
16+
217
## 6.5.5
318
### Bug Fixes
419
- Fixed a bug that prevented the Get-LMAlerts cmdlet from respecting custom -Sort parameters.

0 commit comments

Comments
 (0)