Testing groovy script on local ubuntu machine
I am searching for a way to run groovy scripts on my local ubuntu (WSL) while being able to work with the same classes that are used by the collectors. To achieve this I installed a java+groovy and deployed a collector. However I am unable to import the classes like“com.santaba.agent.groovyapi.snmp.Snmp” Is there any way to achieve this? Or can I somehow locally access the collector shell to test groovy code without the need to use the LM web UI? So, I am basically searching for a way to develop scripted DataSources using CLI, without fiddling with the web UI. Any guidance very much appreciated.Solved238Views18likes9CommentsScripted Alert Thresholds
It should be possible to groovyscript Alert Thresholds, based on (for example) ILPs and hostProperties. I need to modify the SNMP_Network_Interfaces to vary the InDiscardPercent threshold depending on whether this is a radioMAC interface type and whether it is a given customer. Something along the lines of: def isRadio = instanceProps.get('auto.interface.type') == 'radioMAC'; def customerCode = hostProps.get('customer.code'); if(isRadio && customerCode == 'ACME') { // No threshold return ''; } // The default return '> 10';Solved224Views17likes26CommentsOracle 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.74Views15likes0CommentsRunning a Perl script on an AIX box over SSH?
Hi, We have an old monitoring system that we’re trying to decommission and move everything into LM. The current system connects to an AIX server using an SSH Key, and then runs a perl script that’s located in a particular folder. It then takes the output from that script and determines if there’s an alert condition to tell someone about. I need to move this same functionality into LM. I’m assuming the SSH access part shouldn’t be a big deal. I can either manually setup a username/password or I found into on putting a key in LM somewhere and using that. Once LM can connect to the server, can it launch a script file that’s located on the server? I’m not sure if I need to recreate the script inside of LM, or if it can just tell the server to execute the script it already has. If the script runs remotely, can LM then parse the returned data to determine if something is an error or not? If anyone has any tutorials or anything on how I can start working on this, let me know. I don’t know anything about scripting and LM and so far, don’t really know where to start. Thanks!Solved105Views15likes1CommentGroovy4, FastStringService, V.206, etc
I noticed in the detailed release notes for V.206 some discussion of Groovy2 vs Groovy4, because apparently at some point in the future Groovy2 may go away and so Groovy4 will be required. There is some info on mitigation, including updating official modules (with its usual issues, IMO) but also updating custom modules. But it looks like the latest collector doesnt force this now, but just supports both Groovy2 and Groovy4. But I want to move on this as soon as I can. So I did some testing on one of my custom groovy configsources and discovered that when I force the script to use Groovy4 (//!/lib-groovy/v4 on the 1st line) I get one of the errors mentioned in the release notes for V.206 ( https://www.logicmonitor.com/release-notes/v-206-release-notes ). Specifically "Unable to load FastStringService". But unlike some of the other known issues, no workaround or example was given. import groovy.json.*; def JsonSlurper jsonSlurper = new JsonSlurper(); def jsonParsed = jsonSlurper.parseText(responseBody) The first 2 lines are fine, so I believe there is nothing to be changed with how I'm importing it. The docs I see for latest groovy still show I'd use groovy.json.jsonSlurper. But the 3rd line in the code throws the "Unable to load FastStringService" error. So I guess I'm just wondering if the community has dealt with this specific issue, or if there is a document that contains a workaround for this case and others. I know LM will be updating their modules, or maybe they already have (I havent looked; their new Modules UI hurts my brain a bit, not looking forward to the old version under settings going away). But updating all our custom code is going to be painful. Somehow I didnt realize this conversion from Groovy2 to Groovy4 was coming, so I'm trying to figure out when that will be a hard line in the sand. But in the meantime, I'm just wondering if anyone has found a way around this issue? Thanks!176Views14likes4CommentsLogicModule development: script editor line numbers
Great news! LogicMonitor is finally adding line numbers to the groovyscript editor. Only joking. It’s STILL rubbish and there are no plans to fix it. When pairing LogicModule development I STILL have to say “up about 6 lines”, “no not that line”and “down a bit” every few seconds.Solved109Views14likes10CommentsEntering enable mode using JSch
Does anybody have any example code on how to enter enable mode when using JSch? I already have the script working for 95% of my devices, so i don’t want to have to switch to expect. The channel mode is currently exec, which i think is the issue. It’s trying to execute `enable\n${enable_pass}\n${cmd}` all at once and the device is choking on it. Would rather not have to switch to shell mode, but if there’s no way to do it without shell mode, i guess i’ll have to take a stab at it.Solved205Views13likes3CommentsDoes 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.Solved467Views12likes19CommentsSAP_HANA_SystemDatabaseAvailability Test DataSource Script failed
I have a wrong Java environment ? The script failed, elapsed time: 21 seconds - Unable to load Snippet - lm.emit java.lang.Exception: Unable to load Snippet - lm.emit at java.base/jdk.internal.reflect.GeneratedConstructorAccessor103.newInstance(Unknown Source) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83) at org.codehaus.groovy.reflection.CachedConstructor.doConstructorInvoke(CachedConstructor.java:77) at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrap.callConstructor(ConstructorSite.java:84) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:59) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:238) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:250) at Script1.get(Script1.groovy:70) at Script1.load(Script1.groovy:19) at Script1$load$0.callCurrent(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:157) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:185) at Script1.load(Script1.groovy:15) at Script1$load.call(Unknown Source) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) at Script1$load.call(Unknown Source) at Script7.run(Script7.groovy:6)Solved127Views11likes7CommentsAPI Groovy HttpPatch?
Is it possible to do an HttpPatch, or to use the PATCH verb, when updating devices? I looked over on one of the LM pages for updataing devices with the API and as usual, most of the examples were in Python, but PUT did have one Groovy example, but PATCH did not. I’ve seen mention somewhere that at some point PATCH would be supported, wondering if it is or not. I ended up getting my script working with a Get (so I dont lose all my device custom settings etc) and then changing theautoBalancedCollectorGroupId value, and then doing a PUT and it worked, and I didnt lose any of my custom properties. And I have a working filter all set up to run it against a target set of devices. But still, I would rather just patch the fields I want without risk. I’m wondering if thats possible, or if GET/tweak/PUT is still the main go-to?Solved184Views9likes9Comments