ContributionsMost RecentMost LikesSolutionsLogic.Monitor (Release Updates) - v7.0 I am thrilled to announce the release of version 7.0 of the Logic.Monitor PowerShell module, our community-driven tool designed to streamline interactions with the LogicMonitor REST API. This major update introduces several key enhancements aimed at improving usability and functionality. What's New in Version 7.0 Comprehensive Documentation Overhaul We've launched a new, comprehensive documentation site to serve as your go-to resource for all things related to the Logic.Monitor module. The site features: Detailed Command References: In-depth information on each cmdlet, including syntax, parameters, and examples. Code Examples and Snippets: Practical examples to help you understand and implement various functionalities. Best Practices Guides: Recommendations and strategies to optimize your use of the module. Explore the new documentation here: Logic.Monitor PowerShell Module Documentation. Introducing the Filter Wizard Version 7.0 introduces the Filter Wizard, an interactive tool designed to simplify the creation of complex filters. Key features include: Visual Filter Construction: Build filters using an intuitive, user-friendly interface. Support for All Filter Operators: Utilize a comprehensive set of operators to refine your queries. Real-Time Filter Preview: Instantly see the results of your filter criteria as you build them. You can access the Filter Wizard through the Build-LMFilter cmdlet or by using the -FilterWizard parameter with compatible cmdlets: # Use the standalone filter builder Build-LMFilter # Use built-in filter wizard parameter Get-LMDeviceGroup -FilterWizard Community Collaboration The Logic.Monitor PowerShell module is a testament to the power of community collaboration. Developed and maintained by LogicMonitor employees & users, it embodies the collective expertise and dedication of our community. While not an official LogicMonitor product, this open-source project thrives on user contributions. We warmly invite you to participate by reporting issues, suggesting enhancements, or contributing code via our GitHub repository: Logic.Monitor GitHub Repository. Getting Started To install or update to the latest version of the Logic.Monitor module, use the following PowerShell command: Install-Module -Name "Logic.Monitor" -Force Authentication Before using any module commands, you need to connect to your LogicMonitor portal. You have two options for authentication: Direct Connection (LMv1|BearerToken) Connect-LMAccount -AccessId "your_access_id" -AccessKey "your_access_key" -AccountName "your_portal" Connect-LMAccount -BearerToken "your_bearer_token" -AccountName "your_portal" Using Cached Credentials The Logic.Monitor module includes built-in credential caching to simplify managing multiple portal connections. Using Microsoft’s SecretManagement module, you can securely store and access your LogicMonitor credentials without repeatedly entering them. How It Works When you first use the credential caching feature, you’ll be prompted to set up a secure local vault by creating a password. This vault safely stores your LogicMonitor portal credentials, allowing quick and secure access across multiple sessions. First, cache your credentials: New-LMCachedAccount -AccessId "your_access_id" -AccessKey "your_access_key" -AccountName "your_portal" Then connect using cached credentials: Connect-LMAccount -UseCachedCredential # Select from multiple cached portals Enter the number for the cached credential you wish to use: 0) production-portal 1) staging-portal This approach: Securely stores multiple portal credentials Eliminates the need to handle sensitive information in scripts Provides a simple selection interface for multiple portals Leverages industry-standard encryption via SecretManagement We are committed to continually enhancing the Logic.Monitor module and its documentation. Your feedback is invaluable to us; please share your thoughts and suggestions through our GitHub repository. Thank you all for your ongoing support and contributions to the Logic.Monitor community. Logic.Monitor (PowerShell) module If you're a LogicMonitor user looking to streamline your workflows and automate repetitive tasks, you'll be pleased to know that there's is a PowerShell module available to help you do just that. As a longtime Windows administrator, I've relied on PowerShell as my go-to tool for automating and managing my infrastructure. I've found that the ability to automate tasks through PowerShell not only saves time, but also reduces errors and ensures consistency across the environment. Developed by myself originally as a personal side project, this module provides a range of cmdlets that can be used to interact with the LogicMonitor API, making it easier than ever to manage your monitoring setup directly from the command line. Whether you're looking to retrieve information about your monitored devices, update alert thresholds, or perform other administrative tasks, this module has you covered. In this post, we'll take a closer look at the features and capabilities of this module, and show you how to get started with using it in your own automation scripts. This project is published in the PowerShell Gallery at https://www.powershellgallery.com/packages/Logic.Monitor/. Installation From PowerShell Gallery: Install-Module -Name "Logic.Monitor" Upgrading: #New releases are published often, to ensure you have the latest version you can run: Update-Module -Name "Logic.Monitor" General Usage: Before you can use on module commands you will need to be connected to a LM portal. To connect your LM portal use the Connect-LMAccount command: Connect-LMAccount -AccessId "lm_access_id" -AccessKey "lm_access_key" -AccountName "lm_portal_prefix_name" Once connected you can then run an appropriate command, a full list of commands available can be found using: Get-Command -Module "Logic.Monitor" To disconnect from an account simply run the Disconnect-LMAccount command: Disconnect-LMAccount Examples: Most Get commands can pull info by id or name to allow for easier retrieval without needing to know the specific resource id. The name parameters in get commands can also accept wildcard values. Get list of devices: #Get all devices Get-LMDevice #Get device via id Get-LMDevice -Id 1 #Get device via hostname Get-LMDevice -Name device.example.com #Get device via displayname/wildcard Get-LMDevice -DisplayName "corp*" Modify a device: #Change device Name,DisplayName,Descrition,Link and set collector assignment Set-LMDevice -Id 1 -DisplayName "New Device Name" -NewName "device.example.com" -Description "Critical Device" -Link "http://device.example.com" -PreferredCollectorId 1 #Add/Update custom properties to a resource and disable alerting Set-LMDevice -Id 1 -Properties @{propname1="value1";propname2="value2"} -DisableAlerting $true ***Using the Name parameter to target a resource during a Set/Remove command will perform an initial get request for you automatically to retrieve the required id. When performing a large amount of changes using id is the preferred method to avoid excessive lookups and avoid any potential API throttling. Remove a device: #Remove device by hostname Remove-LMDevice -Name "device.example.com" -HardDelete $false Send a LM Log Message: Send-LMLogMessage -Message "Hello World!" -resourceMapping @{"system.displayname"="LM-COLL"} -Metadata @{"extra-data"="value";"extra-data2"="value2"} Add a new user to LogicMonitor: New-LMUser -RoleNames @("administrator") -Password "changeme" -FirstName John -LastName Doe -Email jdoe@example.com -Username jdoe@example.com -ForcePasswordChange $true -Phone "5558675309" There are over ~200 cmdlets exposed as part of this module and more are being added each week as I receive feedback internally and from customers. For more details and other examples/code snippets or to contribute you can visit the github repo where this is hosted. Source Repository: https://github.com/logicmonitor/lm-powershell-module Additional Documentation: https://logicmonitor.github.io/lm-powershell-module-docs/ Note: This PowerShell module is an open-source project created and maintained by LogicMonitor users. While not an official LogicMonitor product, it's designed by people who use and understand the platform. The module is freely available for everyone to use, modify, and improve. We welcome your feedback and contributions! If you have ideas or encounter any issues, please share them through GitHub issues or pull requests. Many community members rely on this module in their daily operations. Though we can't offer formal support guarantees, our collaborative community strives to address questions and continuously enhance functionality. We hope you find this tool valuable for your LogicMonitor workflows! Re: Anyone use the LogicMonitor Powershell module? I know it’s being worked on but I’m not sure on the timeframe for it. Let me check with the PM for the LM API and get back to you. Re: Anyone use the LogicMonitor Powershell module? Hi Gareth, I maintain the PowerShell module. I don’t believe the issue is with the module as it’s more of an API limitation. Can you compare the list of reports you get back using the legacy reports UIv3 and with what you get back from PowerShell? I don’t think reports created in UIv4 will show up in the v3 API at the moment. How 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 setup consistently. Do you have any plans for: “Creating ReportGroup”? (Would be pretty similar to: New-LMDashboardGroup) I see Get-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 setup consistently. Do you have any plans for: “Creating ReportGroup”? (Would be pretty similar to: New-LMDashboardGroup) I see Get-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
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) moduleLogic.Monitor (Release Updates) - v7.0