This tutorial will guide you through the process of creating a custom sensor in PRTG to monitor specific metrics or applications. Custom sensors are a powerful feature that allows you to extend the functionality of PRTG to meet your unique monitoring needs.
Prerequisites
- PRTG Network Monitor installed and running
- Basic knowledge of programming (Python, PowerShell, etc.)
- Access to the PRTG server
Step-by-Step Guide
Create a New Custom Sensor Script
- Open the PRTG web interface and navigate to the "Sensors" section.
- Click on "Add Sensor" and select "Custom Sensor (Script)".
- Enter a name for your sensor and choose the appropriate type of script (e.g., Python, PowerShell).
Write the Sensor Script
- In the script editor, write the code that will retrieve the data you want to monitor.
- For example, if you're monitoring a web server, you might use Python to make an HTTP request and check the server's status code.
Test the Sensor
- Save the script and click "Test Sensor" to verify that it works correctly.
- If the test is successful, the sensor will start collecting data.
Configure Sensor Settings
- In the sensor settings, you can define thresholds, notifications, and other parameters.
- You can also configure the sensor to run at specific intervals or trigger actions based on certain conditions.
Monitor Your Custom Sensor
- Once the sensor is configured, you can view its data in the PRTG web interface.
- You can also create dashboards and reports to visualize your monitoring data.
Example: Monitoring a Web Server
Here's an example of a Python script that checks the status code of a web server:
import requests
def check_web_server(url):
response = requests.get(url)
if response.status_code == 200:
return "OK"
else:
return "Error"
# Replace "http://example.com" with the URL of the web server you want to monitor
url = "http://example.com"
status = check_web_server(url)
print(status)
Learn More
For more information on creating custom sensors in PRTG, check out our Advanced Monitoring Techniques tutorial.
Web Server Monitoring