DataSource PowerShell Active Discovery and Collector scripts
Hello LM Community! I am trying to configure a new DataSource that uses PowerShell scripts for both Active Discovery and Collector Attributes with the end goal being to populate the discovered devices/instances with data. My Active Discovery script is as follows (I've left out the functions that generate bearer tokens and make the MS Graph calls). $tenantID = '<tenantId>' $appID = '<appId>' $appSecret = '<appSecret>' $appCredentials = New-Object System.Management.Automation.PSCredential($appID, (ConvertTo-SecureString $appSecret -AsPlainText -Force)) $authToken = Get-MSGraphAuthToken -Credential $appCredentials -TenantID $tenantID $resourceURL = "https://graph.microsoft.com/v1.0/servicePrincipals" $applications = (Invoke-MSGraphQuery -method GET -Uri $resourceURL -token $authToken -Recursive).value | Where-Object {$_.preferredSingleSignOnMode -eq "saml"} foreach ($application in $applications) { Write-Host "$($application.appId)##$($application.appDisplayName)" } This successfully imports all of the instances as I would expect with their respective 'appId' and 'appDisplayName'. These can be seen under the Resources tab in LM. My Collector Attributes script is as follows (again functions left out): $tenantID = '<tenantId>' $appID = '<appId>' $appSecret = '<appSecret>' $global:appCredentials = New-Object System.Management.Automation.PSCredential($appID, (ConvertTo-SecureString $appSecret -AsPlainText -Force)) $global:authToken = Get-MSGraphAuthToken -Credential $appCredentials -TenantID $tenantID $resourceURL = "https://graph.microsoft.com/v1.0/servicePrincipals" $applications = (Invoke-MSGraphQuery -method GET -Uri $resourceURL -token $authToken -Recursive).value | Where-Object {$_.preferredSingleSignOnMode -eq "saml"} $todayDate = Get-Date foreach ($application in $applications) { $expirationDate = $application.keyCredentials.endDateTime[0] | Get-Date -Format yyyy-MM-dd $daysToExpiration = (New-TimeSpan -Start $todayDate -End $($application.keyCredentials.endDateTime[0])).Days $data = [PSCustomObject]@{ appId = $application.appId expirationDate = $expirationDate daysToExpiration = $daysToExpiration } | ConvertTo-Json $data } When I test this script, I select the Device to run it from and the Instance to run it against. The output contains the 'appId', 'expirationDate' and 'daysToExpiration' properties of all the instances, and not just the instance I want to match the latter two data points to. This would be as expected when looking at the script, but not what I want to achieve. I don't understand how the Collector script is supposed to match the values of the properties to their respective Instances. Could someone please explain this to me? I then want to interpret the output with a JSON parser, so I have some JSON Datapoints configured to pull in the desired 'expirationDate' and 'daysToExpiration'. For example: Interpreter: JSON JSON Path: $.daysToExpiration This appears to only work for one of the properties but not both. I have read other articles and documentation that mentions key pairs, but ideally I would like to stick with JSON.74Views4likes3CommentsAnyone know of a way to monitor for SNapshot age on a Hyper-V machine?
We have some checks that monitor our VMWare system for Snapshots. Once they are over 72 hour old, we get an alert. I haven’t been able to find a way to do the same thing for our Hyper-V servers. Does anyone happen to know if that’s possible? I didn’t see anything in the Exchange but just through I’d ‘check in case someone knew of anything. I can pull the data with Powershell via the get-vm|get-vmsnapshot command. Not sure if that’s usable in LM somehow. Thanks.241Views7likes8CommentsTesla Motors LogicModule Suite
I previously published a datasource for Tesla Motors Battery Statistics - which presents compelling vehicle battery and charging information that is fetched from the Tesla REST API. To complement those efforts, I've written a few other Tesla Motors LogicModules that return a variety of different, but still interesting, datapoints - including a ConfigSource that displays configuration information about the vehicle itself (are the doors locked? Is the sunroof open?) The following is a list of all the Tesla Motors LogicModules now available (see the above-linked post for additional info on how this all works.) DataSource 'Battery Statistics' tracks battery and charger performance and health metrics Tesla Motors Battery Statisticspreviously posted to the Exchange but included here for sake of keeping everything together.) The datasource name isTeslaMotors_BatteryStatisticsand has lmLocatorDXLLKY. DataSource 'Climate Statistics' tracks inside and outside temperatures, as well as driver and passenger temperature settings. The datasource name isTeslaMotors_ClimateStatisticsand has lmLocatorYZRWXC. ConfigSource 'Car Configuration' collects textual configuration data, cleans it up and makes it easily readable (screenshot attached.) The configsource name isTeslaMotors_Configurationand has lmLocatorGRY9AE. DataSource 'Location Data' tracks compass heading, latitude and longitude, and power. The datasource name isTeslaMotors_LocationDataand has lmLocatorAYWYWA. DataSource 'Odometer Reading' does exactly what you might expect. The datasource name isTeslaMotors_BatteryStatisticsand has lmLocatorHHJRD82Views12likes5Commentsparam not found error in datapoint mapping
Hello, I am new to LogicMonitor and need some help. I was working on creating a datasource where the groovy script returns line based output like: QueueDepth.Queue_Name_1=24 QueueDepth.Queue_Name_2=20 The datapoints are created like: Queue_Name_1 →Key- ##WILDVALUE##.Queue_Name_1 Queue_Name_2 →Key-##WILDVALUE##.Queue_Name_2 However, when the data gets polled, it is unable to retrieve it: NaN param not found in output - (method=namevalue, param=.Queue_Name_1) Can someone please let me know what I am missing here. Regards, Shivam170Views8likes9CommentsOracle jdbc JAR file update
LogicMonitor's collector utilizes an outdated version of the Oracle JDBC jar file. It's essential to upgrade to the most recent version available in the Maven repository to take advantage of new secure database connection types. However, users should note a significant change in behavior with the new jar: while the old version automatically closed abandoned Oracle database connections, the new version does not, potentially leading to an excessive number of open connections. This surge in open connections can overload and crash an Oracle server where connections aren’t limited by user. Therefore, clients must either ensure that customizations explicitly close database connections or adjust their server settings to impose limits on the number of concurrent open connections. All of the newest Logicmonitor datasources properly close connections but some of the older modules did not do this. Logicmonitor has created a module to test for this problem and alert if it occurs. Oracle_Database_MonitorUser will keep track of the number of connections in use by the monitoring user and alert if the number of connections is too high. This update is scheduled for collector 35.400. Make sure this module is installed before upgrading to collect 35.400 and monitor your database connections before rolling this out to general release.71Views15likes0CommentsCan I set a different threshold for C drive from D or E drive space?
Hi, Our Windows servers have the standard alerting based on Volume Capacity. When Used Percent gets to 90%, we get a warning, 95% error, etc. How could we change this so that the C drive uses a different set of thresholds than the D drive? Can we do that within the basic DataSource or would we have to have one DataSource that just checks C and one that just checks D? I don’t want to clutter everything up, but if this is easy to do, it would come in handy. Thanks.137Views6likes5Commentsinvalid Output format - root element of output JSON should be "data"
What does means the below message on the following setting ? [MSG] [WARN] [collector-task-thread-collector.batchscript-batchscript-28-1::collector.batchscript:Task:4218:XXX.XXX.XXX.XXX:batchscript:SAP Cloud Connector Memory Status::18] [BatchScriptSlaveTask._prepareOutput:155] invalid Output format - root element of output JSON should be "data", CONTEXT= The output is {"physicalKB":{"total":16469532,"CloudConnector":959296,"others":6477020,"free":9033216},"virtualKB":{"total":41635356,"CloudConnector":4639480,"others":5910204,"free":31085672},"cloudConnectorHeapKB":{"total":4128768,"used":209168,"free":3919600},"version":1}75Views5likes5CommentsWindows Services Monitoring with quite a bit more Automation applied
So today we use LM's Microsoft Windows ServicesDataSource to monitor Windows Services. This DS uses Groovy Script and WMI calls under the hood to fetch the service metrics like state, start mode, status, etc... Everything works fine but one of the prerequisites is to go and manually populate the list of Windows services which then the DS parses out as a WILDVALUE variable in the script. You know, go to the device, click on Down Arrow (Manage Resource Options) --> Add Additional Monitoring --> and CHOOSE from the list of Windows Services. Rinse and Repeat and Save. Then the DS goes to work. Well, what if you have a list of over 100 Windows Services you need to add to let's say 20 Windows devices? That would take forever to populate that list manually... That's a problem number 1. Scratch that. This is not really a problem since one can run a PowerShell script (or Groovy Script) to perform this task using undocumented - but working very well - LM API calls. That problem is solved. Next - This list of over 100 Services needs to be *refreshed* every let's say 24 hours to remove nonexistent services and add new ones based on the Regex filter. That's a problem number 2. And again, one can do it programmatically running API calls but this is where I am trying to figure out how to do it. Run my script as a custom PropertySource? I am not really writing Resource Properties, I am updating instance list (Windows Services) within Additional Monitoring on bunch of Resources. Plus PropertySources are applied when ActiveDiscovery is run which is what, every 24 hours? Or should I write custom DataSource that would accomplish this refresh and specify 1 day collection period? Thanks.Solved582Views4likes2CommentsProcess 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?Solved119Views0likes7Comments