Using Python scripts in WhatsUp Gold
- Last Updated: July 22, 2026
- 3 minute read
- WhatsUp Gold
- Version 2026.1
Before you begin
Python is not installed with WhatsUp Gold. Before you can create or run a Python monitor or action, an administrator must install Python and a small set of required libraries on every poller that will execute Python scripts, including remote pollers.
-
Install Python 3.11 or later, 64-bit, for all users (system-wide), not just the current user. The WhatsUp Gold poller service cannot see a per-user Python install.
-
Add
python.exeto the systemPATHduring installation. -
Install the required Python packages system-wide:
python -m pip install pythonnet requests paramiko pysnmp pywin32 wmi psutilAdd other packages (for example,
dnspython,cryptography,pyodbc) as your scripts require them. -
Copy
Python.Runtime.dllfrom thepythonnetpackage into the WhatsUp Gold installation folder, next toActiveScriptExecutorPython.exe. -
Restart the WhatsUp Gold services from Settings > System Services: restart the main WhatsUp Gold service, then the poller service.
Repeat these steps on any additional or remote poller that will run Python monitors or actions.
Context.SetResult(0,
"ok") and run a manual test.Creating a Python Active Script Monitor or Action
- When creating an Active Script Monitor or Active Script Action, set the Script
type to Python.
Important: The Python option is only available when the Execution Model is set to Isolated Process. Because Direct Data Access is the default execution model, the Python radio button appears disabled until you change the Execution Model to Isolated Process.
-
Enter your Python script in the Script Text field.
-
Set an appropriate Timeout. Scripts that exceed the timeout are treated as failed, and the executor process running them is recycled.
-
If your script needs device credentials (SNMP, SSH, Windows, REST API, and so on), assign the appropriate credentials to the target device.
-
Save the monitor or action, then run a test poll or test trigger to confirm it behaves as expected.
Writing the script
Python scripts interact with WhatsUp Gold through a Context object that
is automatically available in the script — you don't need to import it.
| Method | Description |
|---|---|
Context.GetProperty("Name") |
Returns a device, monitor, or credential property as a string. |
Context.SetResult(code, message) |
Reports the outcome. Use 0 for success/up and
1 for failure/down. Always call this on every code path. |
Context.SetValue(number) |
(Performance monitors) Reports a numeric value to graph. |
Context.LogMessage("text") |
Writes a message to the script's debug log. Never log passwords or other secrets. |
Commonly used properties include Address, DeviceID, and
DisplayName, plus credential properties such as
CredSnmpV2:ReadCommunity,
CredSSH:Username/CredSSH:Password, and
CredRestAPI:*. These match the properties available to
VBScript/JScript active monitors.
Example: simple monitor
address = Context.GetProperty("Address")
if address:
Context.SetResult(0, f"Python monitor executed for {address}")
else:
Context.SetResult(1, "Address property not available")
Example: monitor using an SNMP credential
community = Context.GetProperty("CredSnmpV2:ReadCommunity")
if not community:
Context.SetResult(1, "Missing SNMP v2 read community")
else:
# Add your SNMP query logic here (for example, using pysnmp)
Context.SetResult(0, "SNMP check passed")
Example: simple action
display_name = Context.GetProperty("DisplayName")
Context.SetResult(0, f"Python action ran for {display_name}")
Authoring tips
- Validate required properties early, and fail with a clear message if they're missing.
- Make sure every possible code path calls
Context.SetResult(...). - Wrap risky operations in
try/exceptand convert errors into a clearContext.SetResult(1, ...)message rather than letting the script crash. - Keep scripts within the configured timeout — avoid long sleeps, retries, or unnecessary network calls.
- Never log or return credentials or other secrets in
LogMessageorSetResulttext.
Troubleshooting Python scripts
| Symptom | Likely cause | What to do |
|---|---|---|
| "Python runtime was not found." | Python isn't installed, or it was installed for the current user only. | Reinstall Python 64-bit for all users on the poller. |
| "Bad image format" / "incorrect format" error | 32-bit Python is installed. | Uninstall it and install the 64-bit Python release instead. |
| "pythonnet (Python.Runtime.dll) is not available…" | Python.Runtime.dll wasn't copied next to the
executor. |
Copy it from the pythonnet package's folder into the
WhatsUp Gold install directory, then restart services. |
ModuleNotFoundError for a package your script
imports |
The package isn't installed on the poller running the script. | Install the package on that poller with pip install
<package>. |
| Script works on the main poller but fails on a remote poller | Python or a required package is missing on the remote poller. | Repeat the setup steps on the remote poller. |
| Monitor/action result doesn't match script logic | A code path doesn't call Context.SetResult(...). |
Review the script to ensure every branch (including exception handlers)
calls SetResult. |
| Frequent timeout failures | Script is doing too much work for the configured timeout. | Simplify the script, reduce network calls/retries, or increase the timeout. |