Version 3

    SAM allows you to use any scripting language that you prefer to gather metrics and other information that you wish to monitor. Since Orion lives on Windows there are several scripting languages that you can use "out of the box."

     

    However, if you wish to use another, non-native, scripting language, all you need to do is install that program on your main Orion server (and any additional polling engines).

     

    This is an example of how we can use a Python script to gather information.

     

    1. First, we need to install Python on our Orion server. For this example, i used Python version 3.4.4 - x86 and Python 3.4 Extension for Windows x86.

    2. Once installed make sure that the Python install location is placed in the system environment path variable

              python1.png

    3.  In the Orion Web Console we'll need to create a SAM template and then apply it to a node.

         a. Go to Settings > SAM Settings > Create a New Template. You can call the template whatever you'd like.

         b. Click the green plus sign 'Add Component Monitors'

         c. In the pop up windows search for 'script' on the top right

         d. Select 'Windows script Monitor' and click 'Add.'

     

    4. In that Windows Script Monitor section replace the 'Script Engine' text field with 'python'

     

    5. Click the 'Edit Script' button and paste your python script in there.

         a. Your python script needs to import sys and set stdout at the beginning.

      • import sys

      • sys.stdout = sys.__stdout__

         b. You script also needs to flush the stdout at the end.

      • sys.stdout.flush();

     

     

    You can find more on SAM scripting guidelines here:
    SAM Script Component Monitors - Everything you need to know

     

    Hope this is helpful, if so, please feel free to rate this article.