Updates 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.262Views7likes0CommentsAPI Method to CLEAR an Alert (toggle off=on Alert Enable)
Hello, We have a need to via API, CLEAR an alert. I don’t see any API Methods to clear an alert. I only see methods to GET or POST a Note/ACK. Can you assist me with what API method we can use to clear (toggle on/off) an alert? Thanks, Darren Dudgeon316Views1like13CommentsFixing misconfigured Auto-Balanced Collector assignments
I’ve seen this issue pop up a lot in support so I figured this post may help some folks out. I just came across a ticket the other day so it’s fresh on my mind! In order for Auto-Balanced Collector Groups (ABCG) to work properly, i.e.balance and failover, you have to make sure that the Collector Group is set to the ABCG and (and this is the important part) the Preferred Collector is set to “Auto Balance”. If it is set to an actual Collector ID, then it won’t get the benefits of the ABCG. You want this, not that: Ok, so that’s cool but now the real question is how do you fix this? There’s not really a good way to surface in the portal all devices where this is misconfigured. It’s not a system property so a report or AppliesTo query won’t help here… Fortunately, not all hope is lost! You can use the✨API✨ When you GET a Resource/device, you will get back some JSON and what you want is for the autoBalancedCollectorGroupId field to equal the preferredCollectorGroupId field. If “Preferred Collector” is not “Auto Balance” and set to a ID, then autoBalancedCollectorGroupId will be 0 . Breaking it down step by step: First, get a list of all ABCG IDs https://www.logicmonitor.com/swagger-ui-master/api-v3/dist/#/Collector%20Groups/getCollectorGroupList /setting/collector/groups?filter=autoBalance:true Then, with any given ABCG ID, you can filter a device list for all devices where there’s this mismatch https://www.logicmonitor.com/swagger-ui-master/api-v3/dist/#/Devices/getDeviceList /device/devices?filter=autoBalancedCollectorGroupId:0,preferredCollectorGroupId:11 (where 11 is the ID of a ABCG) And now for each device returned, make a PATCH so that autoBalancedCollectorGroupId is now set to preferredCollectorGroupId https://www.logicmonitor.com/swagger-ui-master/api-v3/dist/#/Devices/patchDevice Here’s a link to the full script, written in Python for you to check out. I’ll also add it below in a comment since this is already getting long. Do you have a better, easier, or more efficient way of doing this? I’d love to hear about it!289Views12likes9CommentsLM Community Newsletter - August 2023
LM Community Spotlight LM Customer of the Month Matt Whitney Meet Matt Whitney! LM Community customer of the month! Matt is a TechOps Administrator at CDI and acts as an LM subject matter expert for CDI's customers and internal engineers. If there is something CDI needs done that is not provided out-of-the-box by LM, Matt can script out custom solutions, such as LogicModules for custom monitoring or API-based reporting. What do you love most about being a member of the LM community? One great thing about the community is that you can see the different ways other people use the product. If I am trying to do something out-of-the-box in LM (custom monitoring/automations/etc) then the forums are the first place I look to get ideas and see how others have solved for similar things. Also if I notice an issue/bug there is likely already discussion about it in the forums, if not then the forums are a great place to get visibility on issues! LM Employee of the Month Patrick Rouse Meet Patrick Rouse!LM Community Employee of the month! Patrick is a Sr. Product Manager joined LogicMonitor January 2022. Patrick is responsible for IT Infrastructure Monitoring (Modules), and passionate about cloud-managed networking. What do you love most about being a member of the LM community? “I love hearing feedback (good or bad) and ideas from our customers!” Top Content Exciting news regarding the LogicMonitor Inner Circle! Read about our new Customer Engagement Platform Summer Launch Modernizing Monitoring: LogicMonitor’s Latest Innovations Product Discussions New VMware modules dropped Accessing the LogicMonitor REST API with Postman and LMv1 API Token Authentication Tech Talk LogicMonitor Collector Ports to be used while monitoring end-user devices LM News Introducing Enhanced Dashboards and Settings in the New UI Open Beta Process New UI eLearning Courses Available in LM Academy Dashboards UIv4 is available starting August 23! New Settings Beta! New Resources UI Datapoint Analysis now available! API v3 usage & migration Enhanced API v3 Experience with Delta on device\device endpoint Experience the new API v3 LogicBots Bytesize Humor Meet Bob! He is a Rhodes Scholar and regularly enjoys wine tasting, truffle hunting, and holidays in Spain. He restores vintage cars for fun and strangely, his shirts don't wrinkle. He hikes the PCT Annually during his unplugged, and catches up on the Hard Core History podcast. Bob’s is such a fungi, he lovesTruffle hunting with his friend Lagotto! 174Views15likes1CommentLogicMonitor.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!36Views4likes0CommentsExperience 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-token409Views33likes7CommentsLM 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!154Views15likes5CommentsLogicMonitor, Groovy, Python and APIs Ohhh my
You just started your new job and they have LogicMonitor as their observability tool, that’s great! One huge step up from other organizations you’ve worked with. The last guy that worked on the platform did a pretty good job of keeping up with the platform but you see some improvements that would really help with the organization of the portal. You want to create multiple folder structures. The first group of nested folders will be based on the equipment location the second will be based on the equipment task. This will allow you to provide additional people access to the portal but limit their visibility into only the things that are in their location or their job function. Yup sounds great, your coworkers like it and more importantly your manager approves. Now how are you going to assign 700 pieces of equipment at 30 different sites to the correct folder with the correct permissions? Oh yeah you got a secret weapon, APIs! The goal of this and subsequent posts is to try to demystify APIs. What are they? How are they used? More importantly, how do they benefit you and of course your organization. This will be the first installment of community posts discussing APIs and how they are used to perform tasks within the LogicMonitor portal. If you are like I was and just dipping your toes into APIs and have started looking at videos on youtube or reading about the power of APIs you might be a bit overwhelmed. That’s perfectly fine, it’s totally understandable! APIs are a new tool that will help you perform repetitive tasks within LogicMonitor or any other application that provides APIs. Since LogicMonitor is a SaaS application you don’t have a database where you can perform queries or other actions. So queries and other tasks are replaced with the use of APIs. As you might have learned growing up, knowing what something is can make it less scary. So, what does API mean? API is an acronym for Application Programming Interface. See not that scary, yeah right. I can tell you that the vast majority of people that use APIs on a regular basis have no idea what the acronym stands for. What really is an API? An API, more specifically a REST API, is an instruction that you can use with an application to do something. The word DO is the key here, better said DO is the verb. The verbs that are used for API calls are as follows: GET allows you to get some information from the application POST allows you create something within the application DELETE allows you to delete something within the application PUT allows you to update something within the application PATCH allows you to update something within the application What’s that that I’m hearing through time and network space? Yup I’m hearing WHOA WHOA WHOA PUT allows you to update something within the application PATCH allows you to update something within the application Both have the same function? Why have two verbs that do the same thing? Well even though both perform a similar function each does it in a different manner. PUT replaces the entire item that you are updating with new data PATCH only replaces a portion of the item you are updating I will go into more detail for each verb in future installments of this series. If you are still with me. Really? I haven’t scared, bored or frustrated you with my ramblings yet? Ok so you are with me, cool. Why should you use up some of the storage in your brain to learn about APIs? APIs will simplify your life while using not only LogicMonitor but any application that provides you API access. Here are a couple more real world examples of how APIs can be leveraged to automate tasks within LogicMonitor A customer has several hundred stores across the United States. The customer wants the stores placed in nested folders Store folder - contains all devices at the store District folder - multiple stores make up a district State folder - All districts within a state Region folder - Multiple states make a region Trying to create this kind of structure manually would take days and be prone to errors. You can create the nested group structure by leveraging APIs with your favorite scripting language, I prefer Python, and a CSV file containing store information. While creating the group structure you can also add any necessary custom properties. Another real world example of leveraging APIs A customer has a very large user list within LogicMonitor, almost 800 users. These users can change roles and/or have their access suspended. Going through all 800 users to set roles, change user groups and update the account status can be daunting and honestly a brain melting task that you probably wouldn’t wish even on the guy that stole that prime parking spot from you at the mall during christmas shopping season. In comes super API and with a bit of Python coding you can perform this whole task automagically. PLUS, since this task was performed using a script you will be able to do this task repeatedly without breaking a sweat. In my next installment I will show how to start using APIs. Since it’s an unspoken rule that all guides need to provide links to relevant information, here are my hopefully useful links. LogicMonitor Swagger A listing of all actions that can be performed using the LogicMonitor API. Learning Python If you are new to coding I recommend Python since it is OS agnostic and has a massive user base and information. Learning Groovy Here you thought groovy was just a word from the 60s and 70s, Au contraire mon frère. Groovy is the primary scripting language used within LogicMonitor. We will go deeper into this Groovy language later on. LogicMonitor How can we do anything without including a link to the best observability platform around.154Views10likes1Comment