ContributionsMost RecentMost LikesSolutionsHow IT administrators can streamline operations using the LogicMonitor API In this article, we’re going to review how LogicMonitor administrators can maximize efficiency and transform their IT operations using LogicMonitor’s REST API and PowerShell. We will cover the following use cases: Device onboarding/offboarding User management Retrieving data Re: Logic.Monitor (PowerShell) module Thanks for creating this. We’ve been using it for a while and ran into a strange issue with authentication on Linux. It works perfectly when we run from a Windows machine, but if we run from a Linux machine (pwsh), we get authentication errors even though the credentials aren’t changed. I’m not sure if this is generally an issue with Linux PowerShell or specific to the module, but thought I’d mention in case it was perhaps a known issue. Here is the type of error we see (the error shows on the LM logs too…but again, the auth credentials are unchanged from what works when the same script is run from a Windows box): Out-PsLogging: [ERROR] 2024-03-02T17:47:29: Unexpected error getting device groups. To prevent errors, Get-LogicMonitorDeviceGroup will exit. If present, the following details were returned: Error message: Authentication failed Error code: 1401 Invoke-Request: Response status code does not indicate success: 401 (). Headers: Name Value ---- ----- X-Version 3 Content-Type application/json Authorization LMv1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx… Body: @S P are you sure you’re talking about the Logic.Monitor ps module? The cmdlet name is not one that I recognize and the error output is different. The Logic.Monitor module is tested on 5.1 and core 7+ for both linux/win OSes so there should not be an issue specific to linux that does not effect windows users as well. Re: Logic.Monitor (PowerShell) module @Steve Villardi I was looking at the get-lmalert one and trying to use the customColumns part to get the ##externalticketid## field back. I tried a few different ways to encode it in PowerShell but it did not seem to work properly or I am just doing it wrong. Have you done it before to get the ticket id back since that is the field where things like a ServiceNow incident # would appear? @Jeff Batchelor Should just able able to specify it in double quotes: “##externalticketid##”. How are you building your command. Below is an example for reference: Get-LMAlert -Id DS15713155 -CustomColumns "##EXTERNALTICKETID##" | select -ExpandProperty customColumns Response: Re: Logic.Monitor (PowerShell) module Hi, I am stringing together a few of your commands to setup Collectors, Resources, Dashboards etc so things are setupconsistently. Do you have any plans for: “Creating ReportGroup”? (Would be pretty similar to: New-LMDashboardGroup) I seeGet-LMReportGroup.ps1 but not a new-LMReportGroup yet. @ryang I can certainly add it into the next update.If there are other commands that would be of use please feel free to open an enhancement issue on the github repo. @ryang I have add support for New/Set/Remove cmdlets for report groups in the latest pull request on github. If you want to grab the updates from there feel free to do so, if your not in a hurry you can also just wait for the 5.0.1 release sometime next week which will have these changed included. Re: Logic.Monitor (PowerShell) module Hi, I am stringing together a few of your commands to setup Collectors, Resources, Dashboards etc so things are setupconsistently. Do you have any plans for: “Creating ReportGroup”? (Would be pretty similar to: New-LMDashboardGroup) I seeGet-LMReportGroup.ps1 but not a new-LMReportGroup yet. @ryang I can certainly add it into the next update.If there are other commands that would be of use please feel free to open an enhancement issue on the github repo. Re: UCS C -Rack server I will Check this @Steve Villardi , thanks for your swift suggestion. No problem, if its your first time using the UCS modules, I will link the support article in case you have any questions:https://www.logicmonitor.com/support/monitoring/networking-firewalls/cisco-ucs-monitoring Re: UCS C -Rack server I would think that the DatasourceCisco_UCS_RackServerComponentswould monitor DIMM status but I do not have a rack server to validate. You can find it in the LMX via locator id:NDLANZ. Let me know if that helps! Re: Logic.Monitor (PowerShell) module Hi Steve, is there a way to update the static threshold at the resource/instance level using one of the already available modules? Cheers I don’t believe therecurrently is any cmdlet for threshold modification outside of the datasource global definition. If that is something that would be helpful to have I can certainly look to add it in the next update. If you want to open it as an issue on github as an enhancement I can notify you when it gets put in the next release. @StLaurie I had some time this evening and was able to add device group and device instance level alert threshold support in the latest release 4.6.2. See below for the full release notes and example command usage. Let me know if this is along the lines of what you were looking for, hopefully it helps your usecase! Release 4.6.2 New Commands: Get-LMDeviceGroupDatasourceAlertSetting: New cmdlet to retrieve alert settings for datasources associated with resources that are a member of a device group. Useful for looking up datasource ids and datapoint info so you can modify group level alert settings using Set-LMDeviceGroupDatasourceAlertSetting. Set-LMDeviceGroupDatasourceAlertSetting: New cmdlet to set group level alert settings for datasources associated with resources that are a member of a device group. Get-LMDeviceGroupDatasourceList: New cmdlet to list out datasource info for all datasources associated with a specified device group. Get-LMDeviceDatasourceInstanceAlertSetting: New cmdlet to retrieve alert settings for datasources instances associated with a resource. Useful for looking up datasource ids and datapoint info so you can modify device/instance level alert settings using Set-LMDeviceDatasourceInstanceAlertSetting. Set-LMDeviceDatasourceInstanceAlertSetting: New cmdlet to set device/instance level alert settings for datasources associated with a resource. Example Usage: Note: Below examples use name parametersto reference portal objects. You should use IDs where possible to avoid excessive look ups when changing configurations in bulk. #Get list of datasources associated with devices that are a member of the Villa Villardi resource group Get-LMDeviceGroupDatasourceList -Name "Villa Villardi" #Get alert seetings for HTTPS datasource at the Villa Villardi resource group level Get-LMDeviceGroupDatasourceAlertSetting -Name "Villa Villardi" -DatasourceName "HTTPS" #Disable alerting at the resource group level for the HTTPS -> status datapoint for all resources in Villa Villardi resource group Set-LMDeviceGroupDatasourceAlertSetting -Name "Villa Villardi" -DatasourceName "HTTPS" -DatapointName Status -DisableAlerting $true #Get device instance alert settings info for datasource NoData_Tasks_By_Type_v2 where the instance name is ping Get-LMDeviceDatasourceInstanceAlertSetting -DatasourceName NoData_Tasks_By_Type_v2 -Name 127.0.0.1 -InstanceName ping #Set device instance alert setting to alert when instance ping has a datapoint named taskCount that has a value > 100 generate a warning Set-LMDeviceDatasourceInstanceAlertSetting -DatasourceName NoData_Tasks_By_Type_v2 -Name 127.0.0.1 -InstanceName ping -DatapointName taskCount -AlertExpression "> 100" Re: Logic.Monitor (PowerShell) module Hi Steve, is there a way to update the static threshold at the resource/instance level using one of the already available modules? Cheers I don’t believe therecurrently is any cmdlet for threshold modification outside of the datasource global definition. If that is something that would be helpful to have I can certainly look to add it in the next update. If you want to open it as an issue on github as an enhancement I can notify you when it gets put in the next release. Re: Logic.Monitor (PowerShell) module @Steve Villardi Awesome - thanks so much for the super quick turn around. Really appreciate it. My only other gentle suggestion is to use Write-Output instead of Write-Host for Write-LMHost as commands can then have their output sent to $null resulting in no output to the host/console. Happy to create a pul request on the repo. Thanks again! _Loz @StLaurie Feel free to open a pull request. Most of the write-lmhost should really be moved to debug/verbose output for the most part but I need to go through and add in cmdletbinding functionality. It’s been on my list to clean up just have yet to get to it. But always appreciate the feedback!
Top ContributionsLogic.Monitor (PowerShell) moduleRe: Logic.Monitor (PowerShell) moduleRe: Logic.Monitor (PowerShell) moduleRe: Logic.Monitor (PowerShell) moduleRe: UCS C -Rack serverRe: UCS C -Rack serverRe: Logic.Monitor (PowerShell) moduleRe: Logic.Monitor (PowerShell) moduleRe: Logic.Monitor (PowerShell) moduleHow IT administrators can streamline operations using the LogicMonitor API