Self-Hosted Network Monitoring with PHP Server Monitor

php server monitorself-hosted network monitoringvps uptime monitoringphp monitoring toolserver status dashboard
Published·Modified·

PHP Server Monitor is a network monitoring tool developed in PHP, designed to check if your websites and servers are up and running. It provides a user-friendly web interface for easy management and viewing. When a server goes down, it automatically sends email or SMS notifications.

PHP Server Monitor Dashboard

PHP Server Monitor supports Ping, Tcping, and website monitoring. Since it requires scheduled tasks like crontab, it is recommended to install it on a VPS. To monitor network changes on foreign VPS servers, I installed PHP Server Monitor on my "Zhanmei Small Host" (Jamei Small Host), allowing me to intuitively see VPS network status changes, which is very convenient.

Installation

GitHub Download Link: https://github.com/phpservermon/phpservermon

Visit the link above to download the latest version, extract it to your site's root directory, and visit http://youdomain.com/install.php to fill in the database information according to the prompts to complete the installation. If you cannot write to the configuration file, you can manually add the database information to config.php as follows:

# Copy configuration file
cp config.php.sample config.php
# Modify configuration file
vi config.php
# Fill in database information
define('PSM_DB_PREFIX', 'monitor_'); # Table prefix, keep default
define('PSM_DB_USER', 'status'); # Database user
define('PSM_DB_PASS', 'xxxxxxx'); # Database password
define('PSM_DB_NAME', 'status'); # Database name
define('PSM_DB_HOST', 'localhost'); # Database connection address
define('PSM_DB_PORT', '3306'); # Database connection port, usually default 3306
define('PSM_BASE_URL', 'http://status.xiaoz.org'); # Website address

Official Installation Documentation: http://docs.phpservermonitor.org/en/latest/install.html

Add Scheduled Tasks

The website installation is not complete yet; you must also add collection tasks, otherwise, data cannot be retrieved. Taking Linux (CentOS) as an example, Linux generally uses crontab for scheduled tasks. The method is as follows:

# Install crontab
yum -y install crontabs
# Add scheduled task
crontab -e
# Add the following content to the scheduled task, modify the path according to actual conditions
*/5 * * * * /usr/local/php/bin/php /data/wwwroot/status.xiaoz.org/cron/status.cron.php
# Reload crontab
service crond reload
  • To check the PHP path method: which php, then change /usr/local/php/bin/php in the command above to your own PHP path.
  • status.cron.php is the PHP Server Monitor script address; please fill in the absolute path.
  • The exec function needs to be enabled, otherwise Ping will not work properly.

Set to Chinese

Yes, PHP Server Monitor supports multiple languages. You can change it to Chinese in the backend settings, as shown in the screenshot below. Adding monitoring and SMTP settings is relatively simple; everyone can explore it on their own.

Language Settings

Backend Screenshots

Backend Overview

Monitoring List

Detailed Status

Summary

PHP Server Monitor is very simple to configure, and its functions are basically sufficient. The code is open source, making it easy to integrate or develop further. Those interested can study it. The main purpose of my installation of PHP Server Monitor is to monitor network changes on foreign VPS servers. Later, I will send monitoring reports weekly or monthly. If you feel these functions do not meet your needs, you can try the more powerful Smokeping, although it is a bit more complicated to configure.

Official Website: http://www.phpservermonitor.org/