Note: This feature is available from AimBetter Agent version 3.4.8.0 and later. Learn how to update the AimBetter Agent.
AimBetter’s Custom Actions feature enables users to remotely execute predefined files directly from the AimBetter web application on one or more monitored servers. This capability enhances automation, streamlines maintenance tasks, and provides administrators with powerful control tools across different environments.
General Requirement
All Custom Action scripts must include a final output containing the exact text:
“AimBetter Success“
This output is used by the system to confirm the successful execution of the script.
Supported File Types and Examples
Custom Actions support the following file types, depending on the target server’s platform.
- Windows:
.ps1 (PowerShell script)
#Example of Powershell file - save as .ps1
# Path to the file
$filePath = "C:\temp\example_ps1.txt"
# Content to write
$content = "This is a test file created by PowerShell."
# Ensure the directory exists before creating the file
$directory = Split-Path $filePath
if (!(Test-Path $directory)) {
New-Item -ItemType Directory -Path $directory | Out-Null
}
# Create the file (overwrite if exists)
Set-Content -Path $filePath -Value $content
# Output success message
Write-Host "AimBetter Success"
- Linux:
.txt(any script saved as a.txtfile)
#!/bin/bash
# Example Linux script - save as example_linux.txt
# Path to the file
file_path="/tmp/example_linux.txt"
# Ensure the directory exists
mkdir -p "$(dirname "$file_path")"
# Write content to the file
echo "This is a test file created by Linux script." > "$file_path"
# Output success message
echo "AimBetter Success"
- SQL Server:
.sql(SQL script)
--Example of SQL script - save as .sql
Select 'Aimbetter Success'
- Oracle:
.sql(SQL script)
-- Example of Oracle SQL script - save as example_oracle.sql
-- Create a test table (optional)
BEGIN
EXECUTE IMMEDIATE 'CREATE TABLE aimbetter_test_table (message VARCHAR2(100))';
EXCEPTION
WHEN OTHERS THEN
IF SQLCODE != -955 THEN -- Ignore "table already exists" error
RAISE;
END IF;
END;
/
-- Insert test message
INSERT INTO aimbetter_test_table (message) VALUES ('AimBetter Success');
-- Commit the transaction
COMMIT;
-- Output success message
PROMPT AimBetter Success
Configuration
A new Custom Actions section is available in the AimBetter Configuration. Administrators can add actions that are available for remote execution via the AimBetter UI.
Action Attributes
Each custom action includes the following fields:
- Type
Select the target platform: Windows, Linux, SQL Server, or Oracle. - File
The full path of the file to be executed. A file browser restricts selection to supported file types based on the chosen platform. - Display Name
Defaults to the file name, but can be customized by the user. - Servers
Specifies the servers on which the action will appear and be available to run. - Status
Each action can be marked as Active or Not Active, controlling its availability.
Note: The actions run under the users configured in the AimBetter Agent.
Custom Actions in the AimBetter Web Application
Users can run configured actions directly from the Servers Tree within the AimBetter UI.
Scope Behavior
- Package Level
Packages may contain servers monitored by different agents. The actions list shown depends on the associated agent. - Host Level
The custom actions list applies to both OS and SQL. - SQL Level
Only SQL-specific custom actions are shown.
Action Execution Flow
The execution flow is consistent with other AimBetter responsive actions.
- Click on the desired custom action
A confirmation pop-up appears:“You’re about to [action]. To confirm this action, please enter the code sent to [email].” - Enter OTP Code
After submitting the confirmation, an OTP code is required. - Execution Status
The system displays a Success or Failure message based on the action outcome. - Latest Actions Log
The action result, including timestamp and status, is shown in the LATEST ACTIONS window.
The Custom Actions feature provides a powerful and flexible way to execute scripts and programs across your monitored infrastructure. With controlled access, multi-platform support, and full execution tracking, administrators gain enhanced operational efficiency and improved automation capabilities.