Forum Discussion

birchall's avatar
birchall
Icon for Neophyte rankNeophyte
7 months ago

Integrating Python Scripts

I have a python script that works with the Cisco ISE API, and returns information about the system certificates, and calculates when they expire. 

Im still quite new to logic monitor, and im dont want to have to relearn an entire programming language so that i can code for logic monitor in groovy. 

Does any one have any advice on getting started with using python scrips along with LM? And in the example above. 
In addition how should I return the data to LM to read? If i have 3 certs all with different expiry dates, how do i split that in to 3 separate alerts? 

Many thanks in advance,

Birchall 

  • Anonymous's avatar
    Anonymous
    birchall wrote:

    im dont want to have to relearn an entire programming language so that i can code for logic monitor in groovy. 

    You and me both. Everybody please ask LM to support Python natively.

    birchall wrote:

    Does any one have any advice on getting started with using python scrips along with LM? And in the example above. 
    In addition how should I return the data to LM to read? If i have 3 certs all with different expiry dates, how do i split that in to 3 separate alerts? 

    Running anything other than Groovy or Powershell is actually quite easy. Your collector just need to know how to run it. For Windows boxes, that means making sure that the user that's running the service knows how to execute .py files. For Linux, it means putting an appropriate shebang line at the beginning of your script, pointing to the python executable. 

    I do this all the time as Python is my primary language and I only started learning Groovy/Java when i started at LM. Let's start with the basics: What OS is your collector? Is Python installed? If you put the script on the collector and just call the file, what happens?

    • birchall's avatar
      birchall
      Icon for Neophyte rankNeophyte

      We are an MSP so we use LM across multiple infrastructures, on multiple different boxes.
      I can try with a shebang, but imagine i would need different versions of the script depending on what OS the collector runs on? 
      I was able to get the same concept to work within a powershell script but python would be so much easier.