PHP Server Monitor is a great litte program that checks whether your websites and servers are up and running. It comes with a web based user interface where you can manage your services and websites, and you can manage users for each server with a mobile number and email address or even have it notify your messaging service such as Pushover. It is similar to uptimerobot, uptime.com or site24x7.com but with more options and best of all OpenSource and Free!
If you are a web developer you probably require some sort of software to monitor different websites, servers or resources, that you maintain and possibly host yourself. There are a lot of enterprise tools out there such as Nagios, Cacti or Zabbix, but sometimes you just need something simple that can check to see if your websites are up and perhaps maybe check a DNS record to see if a domain has been hijacked.
You can host PHP Server Monitor on a $5.00 per month VPS on Digital Ocean, Linode, AWS, or the host of your choice. You can even host it in your own office or home on a Virtual Server or even a Raspberry Pi.
The installation process was pretty straightforward.
- Install LAMP stack on a Server.
- Create database, user, password, and access rights for mysql
- Download .tar.gz and extract to /var/www
- Configure Apache site file to point to phpservermonitor directory
- Edit the config.php file to access the MySQL Database
- Navigate to the IP / URL of your apache server and run the installation script
- Configure your Monitors and setup your Notifications.
- Setup a Cronjob to run every 1 minute.
1. Setup and Ubuntu LAMP Server
Install a LAMP (Linux / Apache / MySQL / PHP) stack on a server of your choice. This can be a VPS hosted on one of the services below or on a RaspberryPI or Virtual Server at your home or office.
- Digital Ocean - Signup and Get a $100 Credit!
- Linode - Signup and Get a $100 Credit!
- or other Server
2. Install PHP Dependancies
sudo apt install php-curl php-cli php-fpm php-json php-common php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear
3. Create database, user, password, and access rights for mysql
mysql -u root -p create database phpservermon; create user 'phpservermon'@'localhost' IDENTIFIED BY 'password'; grant all privileges on phpservermon.* TO 'phpservermon'@'localhost'; flush privileges;
4. Use wget to Downlaod PHPServerMonitor from Github
At the time of this article the current version is v3.5.2. the latest version may be different.
5. Extract files to your web server directory
Extract files to your web server directory and setup the proper permissions on the directory.
tar zxvf phpservermon_gzip_filename -C /var/www/html
Set the proper permissions on the directory.
sudo chown -R www-data:www-data /var/www/html/phpservermon
6. Configure the config.php script
Copy the sample config script to config.php and adjust to your credentials for connection to the MySQL database that was created earlier.
sudo cp /var/www/html/phpservermon/config.php.sample /var/www/html/phpservermon/config.php nano /var/www/html/phpservermon/config.php
Your Config.php file should be similar to this. (with your credentials )
define('PSM_DB_HOST', 'db_host'); define('PSM_DB_NAME', 'db_name'); define('PSM_DB_USER', 'db_user'); define('PSM_DB_PASS', 'db_user_password'); define('PSM_DB_PORT', 'most likely 3306, may also be empty');
7. Configure PHP Timezone
uncomment date.timezone and set your timezone date.timezone = "America/Edmonton" or to your city
sudo nano /etc/php/7.4/apache2/php.ini
Restart Apache for the PHP Timezone changes to take effect.
sudo service apache2 restart
8. Run PHPServerMonitor Install Script
9. Setup a Cronjob for 1 minute intervals
*/1 * * * * root /usr/bin/php /var/www/html/phpservermon-3.5.2/cron/status.cron.php
You can change the settings in the "users" and "config" area's to meet your requirements. We recommend for you to use a service like "Pushover" (rather than relying on email) so you will be notifed immediately of any service outages. Also we like to put a monitor on the cronjob using healthchecks.io. This will notify you if the cronjob stops for some reason.
If you have trouble getting PHPServerMonitor up and running, give us a call or drop us an email. We would be happy to assist you in getting a monitoring server up and running.
Located in Edmonton, AB Canada, Clustered Networks was Incorporated in 2001 and has offered Network / Internet and IT Consulting services for over 20 years. We offer personalized service! Call Us Today! - Click Here for our Contact Info
#website #monitor #phpservermonitor