Introduction
This guide provides a step-by-step process for customers who already have an existing VPS and need to install the monitoring script that enables them to receive notifications regarding their VPS performance.
Steps to Install and Configure the Script:
Step 1: Download the Monitoring Script
You can request via live chat/support ticket to copy the pre-configured monitoring script and paste it with the actual link or location. Save the script to your VPS in a preferred directory. We recommend using:
C:\Alert\
Step 2: Install PowerShell Script Requirements
Ensure that PowerShell is available and updated on your server.For Windows Server 2008 R2 and Windows 7, PowerShell should be updated to at least version 3.0 to avoid compatibility issues.
To check your PowerShell version, run:
$PSVersionTable.PSVersion
If it’s lower than 3.0, download this framework to update PowerShell.
Step 3: Create and Store an Encrypted Password
For secure email sending, you need to store an encrypted password for your SMTP account. Follow these steps:
Open PowerShell as Administrator.
Run the following command to create an encrypted password:
$Password = "youremailpassowrd" | ConvertTo-SecureString -AsPlainText -Force
$Password | ConvertFrom-SecureString | Set-Content "C:\Alert\encrypted_password.txt"
This will create the encrypted password.txt file in the C:\Alert\ directory.
Step 4: Configure the Script
Open the script you downloaded (Set thresholds for CPU and Memory.ps1) in a text editor.
Modify the following fields as needed:
$smtpServer = "yoursmtp" # Your SMTP server
$smtpFrom = "[email protected]" # Sender's email address
$smtpTo = "[email protected]" # Recipient's email address
Update the $smtpTo field to the email address where you want to receive notifications.
Step 5: Do Not Modify the Encrypted Password File
The script references the encrypted_password.txt file that stores your encrypted password. Do not delete or modify this file. It’s essential for sending emails securely.
Example reference in the script:
$encryptedPasswordPath = "C:\Alert\encrypted_password.txt"
Step 6: Set Execution Policy
Before running the script, you need to set the execution policy. This allows you to run scripts on your system. Use the following command:
Set-ExecutionPolicy RemoteSigned
If you encounter issues with the execution policy, you contact our support.
Step 7: Set Up Task Scheduler to Automate the Script
You can configure Task Scheduler to run the script at regular intervals automatically. Follow these steps:
Open Task Scheduler. Click on Create Task. Under the General tab, provide a name for the task (e.g., "Resource Monitoring").
Go to the Triggers tab and create a new trigger. Set it to run the script daily or at an interval you prefer.
In the Actions tab, select Start a Program and enter: Program/script: powershell.exe
Add arguments (replace the path if necessary):
-File "C:\Alert\Set thresholds for CPU and Memory.ps1"Click OK and ensure the task is enabled.
Step 7: Run the Script Manually (Optional)
To ensure everything is configured correctly, you can manually run the script by opening PowerShell and typing:
'C:\Alert\Set thresholds for CPU and Memory.ps1'
Step 8: Testing and Verifying the Setup
Once the script is running, it will monitor CPU and memory usage. If the defined thresholds are exceeded, you will receive email alerts. You can test the email functionality by running the script and checking your inbox for alert notifications.
Need Help?
If you face any issues during the setup or configuration process, please contact us via ticket or live chat, and our support team will be happy to assist you.