I would like to monitor if my web server is in a good condition. It supports PHP.
This article applies to PRTG Network Monitor 7.x
Using phpSysInfo to Monitor the System Health of a PHP Web Server With PRTG
Using scripts from Open Source project phpSysInfo it is quite easy to set up a simple system-health monitoring on any webserver that can run PHP files. You cannot, however, monitor specific parameters, but you can monitor the overall health of your server very easily.
The trick is that phpSysInfo shows red bars as soon as the available memory, CPU resources or disk space fall below a certain threshold. These red bars are shown using images with the word "redbar" in their file name. Using an HTTP Advanced sensor we can monitor the resulting HTML file and check for the word "red". As long as this word is not included in the HTML, the server works fine.
Compatible Server Systems
phpSysInfo runs on these server systems:
- 32-bit MS Windows (NT/2000/XP)
- Microsoft Windows Server 2003
- All BSD Platforms (FreeBSD/NetBSD/OpenBSD/Apple Mac OS X)
- All POSIX (Linux/BSD/UNIX-like OSes)
Steps to Take On Your Web Server
- Download the latest version of phpSysInfo from the project's webpages at SourceForge: http://sourceforge.net/projects/phpsysinfo/
- Copy the files into a dedicated folder of your PHP web server (protecting the folder using a password is recommended because the scripts shows a LOT of information about your web server, although no serious security related information)
- Open the corresponding URL in a web browser
- You should now see the status information in your browser that looks like this: http://sourceforge.net/project/screenshots.php?group_id=15
- Note: Usually the script takes about 10 - 15 second to complete
Steps to Take in PRTG
- In the PRTG web interface, create a new device with the IP address or DNS name of your web server running the PHP script.
- Create a HTTP Advanced sensor (from section "Web Servers") on this device:
- Enter the URL for the phpSysInfo script that you used above
- Enter the word red in the "Response must not include" field
- Optional: If you have enabled password protection on your web server, enter the necessary credentials in the Authentication section
- Leave other settings unchanged and click on Save
- Now you should see a new green-lighted sensor for your server.
- You should add a notification trigger for that sensor so you will be notified in case the sensor is "Down". See user manual section Notifications for more details.