Process Monitoring Batch Script
s there a way we can measure the performance of a Data Source or collectors? Repository:ProcessMonitoring @Stuart Weenig I presume I did not understand why monitoring lots of processes/services on Windows systems, with _Select Data Sources might not be the best approach. Aren’t both making aWMI call? Aren’t both going to bring all the Processes in one go? Can we seethe query count from WMI Vs Batch Groovy?Solved147Views0likes7CommentsProcess Monitoring
Hi @Stuart Weenig Thank you for your awesome work! I was able to use the Win_Process_Stats_Groovy.xmlfile for creating data source for Process. https://github.com/sweenig/lm/tree/main/ProcessMonitoring I am able to see data in Discovery and Collector but under Raw Data in Devices > Data sourceI do not see any data , when I poll I do see data, am I missing something. My Applied To Wizard has the following query I removed the Win_Process_Stats.excludeRegEx &Win_Process_Stats.includeRegEx from “AppliesTo” isWindows() && system.displayname == "server001" or system.displayname == "server001"Solved242Views8likes10CommentsDoes anyone have any experience with monitoring Windows Processes?
I’ve checked the community for datasources and I don’t see anything to what I’m specifically looking for. Our organization currently utilizes the Microsoft_Windows_Services datasource (modified a little bit for our specific needs) to monitor services. I’m looking for something similar to monitor windows processes. Similar to the Microsoft_Windows_Services datasource, what I am hoping to accomplish is provide a list of keywords that will either match or be contained in the process name that I want to monitor, provide a list of machines that I want to monitor those processes on, andthen get alerted on if those processes stop running. Some issues I am running into so far are: Win32_Process always returns a value of NULL for status and state. So I cannot monitor for those two class level properties. Powershell’s Get-Process does not return status or state, rather it just looks for processes that are actively running, so I would need to get creative in having LogicMonitor create the instance and what value to monitor in the instance. Some of the processes I want to monitorcreate multiple processes with the same name, and LogicMonitor then groups them all together into one instance, which makes monitoring diffucult. Some of the process I want to monitor are processes that only run if an application is manually launched, which means that again I will need to get creative in how I set up monitoring because I don’t want to get alerts when a process that I know shouldn’t be running is not running. Because the processes I am trying to monitor are not going to be common for everyone everywhere, something that other people could do to try to replicate my scenario would be: Open Chrome. When Chrome is launched, you will get a processed called “Chrome”. Now, open several other tabs of Chrome, you will just get more processes named “Chrome”. Now, keeping in mind the points I made earlier, set up monitoring to let you know when the 3rd tab in Chrome has been closed, even though the rest of the Chrome tabs arestill open. How would you break that down? My first thought would be to monitor the PIDs, however, when you reboot your machine, your PIDs will likely change. Also, I don’t want to have the datasource wild value search by PID, because that would get confusing really fast once you have 2 or 3 different PIDs that you want to monitor. All suggestions are welcome, and any help is greatly appreciated. Bonus points if you can get this to work with the discovery method as Script and you use an embedded Groovy or Powershell script.Solved492Views12likes19CommentsSample Webcheck via Groovy Scripts to test-out!!!
In LM tool, you can choose to manually add your request and response Groovy scripts directly into the text boxes found under both of these Script tabs or, as shown next, you can choose to first complete the fields under the Settings tab (e.g.HTTP Version,Method,Follow redirect,Authentication Required,Headers,HTTP Response Format, etc.) and then click theGenerate Script from Settingsbutton to have LogicMonitor auto-generate request and response scripts based on those settigs. The latter option produces a basic template for your Groovy scripts. (For more information on completing the fields found under the Settings tab for both the HTTP request and response, seeAdding a Web Check). So with LM platform tool, you can alsoauto-generate request and response scriptsscript as shown in above screenshot. Now hereis an sample script to providing a code snippet in Groovy that's using the Santaba HTTP library to make an HTTP GET request to a specified URL (in this case, "https://www.google.com") and retrieve headers from the response. Additionally, it appearsto set basic authentication credentials for the request. The script here is just for reference,to test the scripted HTTP responses.This code block here is the part which makes the http get to google Here's a breakdown of your code: import com.santaba.agent.groovyapi.http.*; // Instantiate an http client object for the target system httpClient = HTTP.open(); // Set basic authentication credentials httpClient.setAuthentication("myusername", "mypassword"); // Specify the URL url = "https://www.google.com"; // Perform an HTTP GET request def getResponse = httpClient.get(url); // Get headers from the response headers = httpClient.getHeaders(); // Close the http client httpClient.close(); Alternatively you can leverage the LM tool to monitored the Few things to note for the code here : The code appears to be setting basic authentication credentials ( myusername and mypassword ), but it's important to note that sending credentials in plaintext might not be secure. Consider using HTTPS and more secure authentication methods if available. The code is making an HTTP GET request to the specified URL ( "https://www.google.com" ) and storing the response in the getResponse variable. After the request, the code retrieves headers from the response using httpClient.getHeaders() and stores them in the headers variable. Finally, the HTTP client is closed using httpClient.close() . Link for more references : https://www.logicmonitor.com/support/services/adding-managing-services/executing-internal-web-checks-via-groovy-scripts Example Request Script Commands Keep Learning & Keep Exploring with LM !!!!!! Interested in learning more about features of your LogicMonitor portal? Check our some of our webinars in our community!https://www.logicmonitor.com/live-training-webinars Sign up for self guided training by clicking the "Training" link at the top right of your portal. Check out our Academy resources!https://www.logicmonitor.com/academy/276Views20likes0Comments