Groovy4, 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!102Views8likes3CommentsAPI 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?Solved167Views9likes9CommentsOracle 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.71Views15likes0CommentsWindows 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.Solved614Views4likes2CommentsTesting 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.Solved220Views18likes9CommentsGroovy IDE recommendations for DataSource/ConfigSource development?
As I develop more and more ConfigSource and DataSource items in our portal, I find that I’m pretty hampered at times by the limited window space. Maybe its been silly of me all along to be developing in that window. But I’m wondering if anyone here has a recommendation on a Groovy IDE …. I havent researched yet so I dont know if there are multiple ones, or just one main one people use. But I’m wondering if any of you have suggestions on the best IDE, or if there are some ways to make sure the IDE environment is as similar to the ConfigSource window in terms of which imports are needed or available etc. Any advice on a best IDE or best practices for developing Groovy for LogicMonitor on the regular? Thanks!Solved165Views7likes4CommentsEntering 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.Solved194Views13likes3CommentsSAP_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)Solved122Views11likes7CommentsRunning 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!Solved96Views15likes1Comment