How to Configure a Python Agent Plug-In

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #17747
    Donna Zehl
    Keymaster

     

    Description:

    First make sure python is in your user & system path.

    We also introduced a requirement that scripts on Windows now need a Unix-style shebang line at the very top, which HVR then interprets ie..

    At the start of your python script it is recommended you set he shebang.

    This actually works on Windows and Linux

    #!python

    On Linux, however,  it is more usual to see the format of

    #!/usr/bin/env python

     

    The path to python in the scheduler’s environment should be checked/set as well.

     

    Steps

    • First make sure python is in your user & system path. If exe is not in your path you have to add it and if your running Windows you must restart your PC for it to take effect.

     

    • At the start of your python script it is recommended you set the shebang.

    On Window has the format

    #!python

    Or on Linux that has the format of

    #!/usr/bin/env python

     

    An example script on a Windows would look like this and save with the extension .py, ie. test.py

     #!python
    
    import os
    
    import sys
    
    if __name__ == "__main__":
    
      print("success")
    
    sys.exit(0)

     

     

    Most of agent plugins run on the integrate node.

     

    The Action:

    AgentPlugin screen would be defined like this for the location MSTGT, a Sqlserver target with the channel name chn1 calling the python script ‘test.py’ running on target Windows server with the path  in my example @ C:Usershvrtestpythonscripts.

    You should also run a test if you can run via command line like this on Windows to verify it works, for example

          python <script fully pathed>
    
          C:usershvtestpython C:usershvrtestpythonscriptstest.py

     

     

     

     

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.

© 2020 HVR

Test drive Contact us