Is it possible to run inline Groovy with Invoke-LMCollectorDebugCommand? #78
-
|
I’m trying to figure out how to pass Groovy code with Invoke-LMCollectorDebugCommand, and I’m not sure it’s possible. There isn't much documentation from LogicMonitor, and everything I’ve tried so isn't working. Here’s a minimal example that fails: which relults in this error: If I open the collector debug console, open the groovy popup window and run Groovy manually, it works fine: The only clue I have that I can pass groovy to the the collector is the help output. The second usage suggests the collector should accept inline "scriptbody" if prefixed with \n, but I haven’t managed to get anything working on the console or the PowerShell wrapper. Has anyone managed to send inline Groovy to a collector using Invoke-LMCollectorDebugCommand or via the collector debug window? Is inline Groovy supported, or is the help text misleading? Any working example or clarification would be appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
|
You should be able to achieve what your trying to do via the PowerShell module/Rest API. It's been a minute since I've personally tried to run a remote groovy cmd via the module but let me take a look and see what's causing the issue if any. I don't have a unit tests for this particular cmdlet due to the nature of how it works but let me check if possibly the API structure has changed. |
Beta Was this translation helpful? Give feedback.
-
|
@rdmarsh I think I see what the issue was. I just released a new version 7.7.4 that fixes the issue. I have some pre execution code that runs when using the inline -GroovyCommand that I have to autoPopulate the hostProps and instanceProps when specifying a -CommandHostName and -CommandWildValue: Somehow it was picked up and reformatted by my code linting. I went and fix the bug if you want to try running that v7.7.4 version and see if that fixes your issue: |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for this fix! Finally got back to looking at this. I'm not 100% sure why but for some reason having the single quotes on the outside doesn't always return any results.
Anyway, thank you for the fix! |
Beta Was this translation helpful? Give feedback.
@rdmarsh I think I see what the issue was. I just released a new version 7.7.4 that fixes the issue. I have some pre execution code that runs when using the inline -GroovyCommand that I have to autoPopulate the hostProps and instanceProps when specifying a -CommandHostName and -CommandWildValue:
Somehow it was picked up and reformatted by my code linting. I went and fix the bug if you want to try running that v7…