ContributionsMost RecentMost LikesSolutionsMonitoring folders on Windows servers I was recently asked by a customer if it was possible to monitor the size of a folder or the file count in a folder on a Windows server. Well there sure is, <whistles> YO UNC Monitor- come on down. UNC Monitor- is part of the Core DS, the DSs that are installed by default when LogicMonitor is first deployed. As seen on the UNC Monitor Description section: Great, there is a way to do this. Ok how do I do this? Hmm? Well looking at the next section of the DS, Technical Notes. Add an instance manually, oooohh k. But how do I perform this specific voodoo? Hmm maybe if I look further down on the DS? Ok there is the Groovy Script, what do I get when I run the Test Script? Ok so I do have 5 folders that contain 41 files using a total of 7,013 KB. Great that’s some info but still not what I need for a path and I still don’t know how to “add the instance manually” Maybe there is some documentation on how to do this? Oh yeah it’s right here Step 2 states “click the down arrow icon button located next to the manage button for that device. From this dropdown menu, select “Add Other Monitoring” So now I know the steps I need to take and I know that there are folders that are shared. How do I know what the shared folders are without having to log onto the server? That’s where the debug facility comes in for help. The easiest way to access debug is open any raw data screen and click on debug You will be presented with all the available commands. To assist in finding the available folder shared we will be using !wmi If you aren’t familiar with any command just type the command and you will be presented with information. In this case I want to show the shared folders on this server. With a bit of knowledge on Win32 Classes we can find this info. I’ll cover Win32 Classes in another post. Now I have everything I need to get this folder monitored through UNC, RIGHT?!? RIGHT?!? I’m looking at the device and there is no DS for UNC showing How do I add it manually if I don’t have DS ugggh. Since I have my handy dandy info from the documentation I know I need to: Once you click on that you get Add a name as you want it to show up on the instance list. Then you can add a path from the list that was obtained through leveraging the debug facility. Once both of those are filled in, hit save twice and tada you get And more importantly you now have alert tuning that you can perform on this specific UNC drive LogicMonitor, 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.