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 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 ~150 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/stevevillardi/Logic.Monitor Additional Code Examples:https://github.com/stevevillardi/Logic.Monitor/blob/main/EXAMPLES.md Note: This is very much a personal project and not an official LogicMonitor integration. If the concept of a native PowerShell module interest you, I would recommend putting in a feedback request so that the demand can be tracked.2.3KViews54likes29CommentsExperience the new API v3
As you all know, we have implemented all the latest enhancements in LogicMonitor REST API v3 ONLY. Some of the key features that work only with API v3 are: Advance filtering to get accurate result Bearer token for authentication Delta feature on device\devices endpoint (coming soon…) To start using all these features, we strongly recommend you to upgrade to LogicMonitor API v3 as the base version in your environment. For more details, refer to the following support articles: REST API v3 Swagger doc: https://www.logicmonitor.com/support/v3-swagger-documentation REST API v3 Advanced filtering: https://www.logicmonitor.com/support/rest-api-advanced-filters Bearer token with REST API v3: https://www.logicmonitor.com/support/bearer-token410Views33likes7CommentsNew API V3 Group for all your API V3 Usage & Migration questions!
Welcome to the API V3 Usage & Migration Group! LogicMonitor REST API v3 Swagger documentation contains a complete list of v3 API endpoints and Models related to the endpoints. You can expand each API endpoint to explore the details. It contains request and response parameters with examples and description. Click Here to Join! Stay tuned for quarterly webinardates!107Views19likes0CommentsEnhanced API v3 Experience with Delta on device\device endpoint
Try out the feature today and let us know how it enhances your API Journey Getting the difference between APIs, often referred to as "diffing" or "delta comparison," involves comparing two versions of data or resources to identify the changes that have occurred. Time-based diffing is particularly useful when you want to understand how data has evolved or when you need to apply updates to a dataset based on changes that occurred between two timestamps. Our Customers Ask is …. ensure our data is accurate, reliable, within the rate limits, & lessen effort examining the data elements, fields, or attributes, LM Delta V3 API is a one-stop feature to identify the latest changes that can be used to craft a dashboard, or send it across integration, and granular refinement by leveraging advanced filtering on Delta API. Below are the endpoints: GET /santaba/rest/device/devices/delta – Registers delta request and generates a new delta Id. It also returns all devices that match the filter criteria. GET /santaba/rest/device/devices/delta/<DELTAID> – Returns devices that have any delta between the last and the current API call. Don't miss out on the advantages of the feature….. Stay Tuned125Views19likes6CommentsTech Enablement session for API v3
Hello LM Community! As part of our initiative to help customers understand new features added to LogicMonitor, we regularly conduct Tech Enablement sessions. This session gives customers an opportunity to learn new features and get answers to their questions. We recently conducted one such enablement session for LogicMonitor REST API v3 that mainly focused on Delta API and Advanced filters with in-depth analysis and examples. Below is the session link: https://logicmonitor.wistia.com/medias/eezt58kfvh You can listen to the recorded session to get all the details. However, to efficiently use your time, you can refer to the items we have timestamped for you. 4.09 - Introduction: Quick overview of API v3, endpoints names, and the Delta API 5.11 - API v3 Swagger articles, Advance filter articles, Delta feature in API v3 6.34 - Examples – Advanced filtering with device\devices endpoint 7.44 - Advanced filtering with filter and fields parameters on auto properties using the AND operator 10.02 - Advanced filtering with system properties using the OR operator 13.42 - Examples – Filering devices based on display name with the OR operator 14.15 - Examples – Filtering using offset, size, and default size limit 15.38 - Advance filtering with alert\alerts endpoint 15.47 - Difference between device and alert endpoint filter 17.15 - Filtering alert\alerts endpoint based on severity 18.00 - Filtering alert\alerts using the offset and size parameters 22.00 - Filtering alert\alerts API with epoch time 22.49 - Delta API and its examples 32.37 - Q&APlease contact your CSM for any query, or to participate in the Delta API beta program and get access to its support document. Happy learning!102Views15likes8CommentsLM API v3 Python boilerplates
In light of the coming sunset of v1 and v2 of LM API, I decided to start updating some of my own scripts. I ran successful tests ofthese python boilerplates with v3:https://github.com/krshearman/LMAPI_v3 I hope it helps someone get started using LM API v3!154Views15likes5CommentsFeature Request: Website Properties
Two requests: 1. Website Inherited Properties Please could the website entity have an “inheritedProperties” field added, much like resources do. This will not require any additional UI, but saves a lot of API round trips. 2. Website Custom Properties Please could the website entity have an “customProperties” field added, much like resources do. This WILL require additional UI on the Website Create/Edit Dialog. Happy if this is UIv4 only.26Views13likes4CommentsUpdates for LogicMonitor REST API v1, v2, and v3
Hello LM Community! It’s been a little while since we last shared an update on LogicMonitor API, so we wanted to touch base, and provide you with the latest news. To catch you up to speed, in 2022, LogicMonitor began supporting LogicMonitor REST API version 3 (also known as API v3). Our goal has always been to improve our API experience. Since v3’s introduction in 2022, enhancements and fixes have solely been made to API v3 (not v1 and v2). During planning for the sunsetting of LogicMonitor REST API v1 and v2, we have had many discussions with our customers in order to better understand the various scenarios and challenges that might be faced throughout that sunsetting process. While we continue to encourage all of our customers to migrate to the upgraded API v3, we are temporarily pausing on the actual sunsetting of API v1 and v2. We will keep you updated on those sunsetting plans as they are finalized. Please continue to plan your migrations to API v3, and below you’ll find just a few of the reasons (benefits) for doing so: API v3 is an upgraded version of API v2, and it has all of the latest features and patches Any future enhancements and defect fixes will only be completed for API v3 API v3 has in-depth support documentation for you to reference For more information on LogicMonitor REST API v3, please refer to the below documentation: Using LogicMonitor’s REST API LogicMonitor REST API v3 Swagger Documentation LogicMonitor v3 SDKs Best Practices for Migrating to LogicMonitor v3 SDK LogicMonitor REST API v3 Basic filters LogicMonitor REST API v3 Advanced filters Bearer Token If you have any questions, please contact our Technical Support Team.265Views7likes0CommentsLogicMonitor.Api nuget package for .NET developers - full v3 API support
For those developers who have chosen the C# / .NET software development path… Our“LogicMonitor.Api” nuget package is open source (MIT license), free (as in beer) and tried and tested in many, many software projects (680,000+ downloads and counting!) Find it here: Source:https://github.com/panoramicdata/LogicMonitor.Api/ Nuget:https://www.nuget.org/packages/LogicMonitor.Api/ Some advantages to using this library: Never worry about paging ever again. It’s all built in: var devices = await logicMonitorClient .GetAllAsync<Device>(cancellationToken) .ConfigureAwait(false); Ignore back off responses. It’s all handled for you. All requests and responses are strongly typed Is it an integer, a byte or a long? We’ve found out and implemented it We use .NET best naming practices. No moreconfusion between hostname, displayname, name, host group, device group, resource group and hstgrp etc. Is it numOfX, numberOfX, xNum or… It’s XCount. As it should be, and consistently throughout. What about CreationDtos? Yep, we’ve done them. LogicMonitor has an undocumentedAPI feature whereby… Yes, we know. It’s in there. Why does the documentation not tell me…? We’ve had to work it out. It’s in there. Can I…? Yes, and if not, let us know and we’ll add it. Pull requests gratefully received!36Views4likes0CommentsLM API
Interesting in hearing some use cases you guys have for the LM API? I have a few scripts setup for mass device manipulation in the case of a change, mass auto discovery, automatically add a Windows server based off AD group, and automated internal ping scans based off a few parameters. Curious to see use cases you guys are using.100Views3likes8Comments