Simple Command Line Probe using Python

InterMapper allows you to create probes (plugins) that test a device and display the results of that test. A command-line probe runs a program or script (as if you had typed it on the command line) and displays the results of that script in the Status Window on the map.

The example probe below demonstrates how to write a command line probe with a short Python program embedded within the probe file itself. For more information, read the Command Line Probe section of the Developer Guide or contact support.intermapper@helpsystems.com

You can download the file 
  

Code:
<!--
Command Line Probe in Python (com.dartware.commandline.python.txt)
Demonstrates the <tool:xxx> section
Please feel free to use this as a base for further development.
-->

<header>
    type            =    "cmd-line"
    package         =    "com.dartware"
    probe_name      =    "commandline.python"
    human_name      =    "Command Line-Python"
    version         =    "1.1"
    address_type    =    "IP"
    display_name    =    "Miscellaneous/Test/Command Line-Python"
</header>

<description>
\GB\Companion Script Example in Python - Using the "tool" Section of a Probe\p\

This probe launches a trivial Companion Script -- a two-line Python script that's embedded within the probe.

The script sets and returns two values ($val1 and $val2), and also shows how to set the probe's condition string.

In addition, the exit status ("1" in this example) sets the severity of the device.
</description>

<parameters>
</parameters>

<command-line>
   path=""
   cmd="${PYTHON} test.py"
   arg=""
</command-line>

<command-exit>
-- The full range of InterMapper status/exit codes
        down:    ${EXIT_CODE}=4
    critical:    ${EXIT_CODE}=3
       alarm:    ${EXIT_CODE}=2
        warn:    ${EXIT_CODE}=1
        okay:    ${EXIT_CODE}=0
</command-exit>

<command-display>
\b5\Companion Script Return Values\p0\
\4\  Value1:\0\ $val1
\4\  Value2:\0\ $val2
</command-display>

<tool:test.py>
# Trivial example to return two values and a text condition string

print "\{ $val1 := 1, $val2 := 'abcdef' }Condition string - device should be yellow"
raise SystemExit, 1           # Return code sets device status (1 = Warning severity)

</tool:test.py>

Simple Command Line Probe using Python

InterMapper allows you to create probes (plugins) that test a device and display the results of that test. A command-line probe runs a program or script (as if you had typed it on the command line) and displays the results of that script in the Status Window on the map.

The example probe below demonstrates how to write a command line probe with a short Python program embedded within the probe file itself. For more information, read the Command Line Probe section of the Developer Guide or contact support.intermapper@helpsystems.com

You can download the file

Code:
<!--
Command Line Probe in Python (com.dartware.commandline.python.txt)
Demonstrates the <tool:xxx> section
Please feel free to use this as a base for further development.
-->

<header>
    type            =    "cmd-line"
    package         =    "com.dartware"
    probe_name      =    "commandline.python"
    human_name      =    "Command Line-Python"
    version         =    "1.1"
    address_type    =    "IP"
    display_name    =    "Miscellaneous/Test/Command Line-Python"
</header>

<description>
\GB\Companion Script Example in Python - Using the "tool" Section of a Probe\p\

This probe launches a trivial Companion Script -- a two-line Python script that's embedded within the probe.

The script sets and returns two values ($val1 and $val2), and also shows how to set the probe's condition string.

In addition, the exit status ("1" in this example) sets the severity of the device.
</description>

<parameters>
</parameters>

<command-line>
   path=""
   cmd="${PYTHON} test.py"
   arg=""
</command-line>

<command-exit>
-- The full range of InterMapper status/exit codes
        down:    ${EXIT_CODE}=4
    critical:    ${EXIT_CODE}=3
       alarm:    ${EXIT_CODE}=2
        warn:    ${EXIT_CODE}=1
        okay:    ${EXIT_CODE}=0
</command-exit>

<command-display>
\b5\Companion Script Return Values\p0\
\4\  Value1:\0\ $val1
\4\  Value2:\0\ $val2
</command-display>

<tool:test.py>
# Trivial example to return two values and a text condition string

print "\{ $val1 := 1, $val2 := 'abcdef' }Condition string - device should be yellow"
raise SystemExit, 1           # Return code sets device status (1 = Warning severity)

</tool:test.py>