Forum Discussion

Lewis_Beard's avatar
2 years ago

Groovy 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!

  • Anonymous's avatar
    Anonymous
    2 years ago

    I think the developers at LM have a preferred IDE (IntelliJ), but it never made sense for me not coming from a Java background. I use VS Code combined with the collector debug window. I run an interactive Groovy console through docker `docker run --rm -it groovy` which lets me test syntax and stuff. I would really love it if LM made an extension for VS Code that would let you run groovy or powershell scripts on a chosen collector against a chosen object. That would really speed up my development. As it is, I develop my code in VS Code, then copy and paste into a !groovy or !posh dialog in the collector debug. I have to choose the device every time. It’s not great, but it works. I may go to bard/chatgpt to have it help me develop the VS Code extension since all that stuff can be done through the API.

    There’s also coretools floating around somewhere that allow you to run .groovy files from your command line. It uses your browser’s cookies for authentication and uses the API to push !groovy tasks through the collector debug console.

    I really wish LM did more for developers.

  • Anonymous's avatar
    Anonymous

    I think the developers at LM have a preferred IDE (IntelliJ), but it never made sense for me not coming from a Java background. I use VS Code combined with the collector debug window. I run an interactive Groovy console through docker `docker run --rm -it groovy` which lets me test syntax and stuff. I would really love it if LM made an extension for VS Code that would let you run groovy or powershell scripts on a chosen collector against a chosen object. That would really speed up my development. As it is, I develop my code in VS Code, then copy and paste into a !groovy or !posh dialog in the collector debug. I have to choose the device every time. It’s not great, but it works. I may go to bard/chatgpt to have it help me develop the VS Code extension since all that stuff can be done through the API.

    There’s also coretools floating around somewhere that allow you to run .groovy files from your command line. It uses your browser’s cookies for authentication and uses the API to push !groovy tasks through the collector debug console.

    I really wish LM did more for developers.

  • Anonymous's avatar
    Anonymous

    I think the developers at LM have a preferred IDE (IntelliJ), but it never made sense for me not coming from a Java background. I use VS Code combined with the collector debug window. I run an interactive Groovy console through docker `docker run --rm -it groovy` which lets me test syntax and stuff. I would really love it if LM made an extension for VS Code that would let you run groovy or powershell scripts on a chosen collector against a chosen object. That would really speed up my development. As it is, I develop my code in VS Code, then copy and paste into a !groovy or !posh dialog in the collector debug. I have to choose the device every time. It’s not great, but it works. I may go to bard/chatgpt to have it help me develop the VS Code extension since all that stuff can be done through the API.

    There’s also coretools floating around somewhere that allow you to run .groovy files from your command line. It uses your browser’s cookies for authentication and uses the API to push !groovy tasks through the collector debug console.

    I really wish LM did more for developers.

    Officially put this feature request in today.

  • This does sounds like a great feature request! 
    It would be awesome to dev within an IDE without having to copy and paste between windows.  
    I also use VS Code since it helps me catch all my syntax errors and such, and then move it into the collector debug from there.  I always do a final bit of testing directly in the LogicModule too, in case my output is not in quite the right format. 

    I think the developers at LM have a preferred IDE (IntelliJ), but it never made sense for me not coming from a Java background. I use VS Code combined with the collector debug window. I run an interactive Groovy console through docker `docker run --rm -it groovy` which lets me test syntax and stuff. I would really love it if LM made an extension for VS Code that would let you run groovy or powershell scripts on a chosen collector against a chosen object. That would really speed up my development. As it is, I develop my code in VS Code, then copy and paste into a !groovy or !posh dialog in the collector debug. I have to choose the device every time. It’s not great, but it works. I may go to bard/chatgpt to have it help me develop the VS Code extension since all that stuff can be done through the API.

    There’s also coretools floating around somewhere that allow you to run .groovy files from your command line. It uses your browser’s cookies for authentication and uses the API to push !groovy tasks through the collector debug console.

    I really wish LM did more for developers.

  • Anonymous's avatar
    Anonymous

    My reasons and workflow as well. 

  • Hi Guys,

    I came across this post on New Years Eve as I have found myself getting frustrated for having to use the collector debug to test my groovy scripts and wondered if there was anything for in the IDE and I couldn't find anything.

    Anyways I have written a VSCode extension here:

    https://github.com/David-Brierley/Logicmonitor---VSCode-Groovy-extention/tree/main

    Its for running groovy scripts against devices from within the VSCode IDE.

    In short.
    You login using your company and APIKey (LM Bearer Token).
    ^^ These are stored in secretStorage on VSCode and can be set to clear each time you use the extension.

    You then right click in the window and run the script (Or run from command pallete)

    It will open a couple of prompts that will let you search for the device by either name or IP address.
    You then select the device and the script runs and it returns the output in a web view panel.
    Theres some other commands etc.

    I haven't published it to the exchange yet as its the initial release of it and theres still bits to do but all the source code is in the above repo and the VSIX file is too so you can download it and install it through there.

    If anyone wants to check it out then feel free to, Its my first time writing a VSCode extension, I use JS / Node for react but mainly I develop in Python so there may be a few Python Mannerisms in the code.

    Anyways hopefully it can help somebody, feel free to contribute or request other features or changes and I'll get round to sorting.

    Cheers !