PHP Server Monitor
PHP Server Monitor is an open source tool to monitor your servers and websites.
Prerequisites
We’re using PHP in the stable version 8.1:
[isabell@stardust ~]$ uberspace tools version show php
Using 'PHP' version: '8.1'
[isabell@stardust ~]$
You’ll need your MySQL credentials. Get them with my_print_defaults
:
[isabell@stardust ~]$ my_print_defaults client
--default-character-set=utf8mb4
--user=isabell
--password=MySuperSecretPassword
[isabell@stardust ~]$
Your website domain needs to be set up:
[isabell@stardust ~]$ uberspace web domain list
isabell.uber.space
[isabell@stardust ~]$
Installation
To install PHP Server Monitor we download the current version from the github release. cd
to your DocumentRoot so the zip file will be under your html
.
[isabell@stardust ~]$ cd /var/www/virtual/$USER/html/
[isabell@stardust html]$ wget https://github.com/phpservermon/phpservermon/releases/download/v3.5.2/phpservermon-3.5.2.zip
[isabell@stardust html]$ unzip phpservermon-3.5.2.zip
[isabell@stardust html]$ rm phpservermon-3.5.2.zip
[isabell@stardust html]$ mv phpservermon-3.5.2/* phpservermon-3.5.2/.* ./
[isabell@stardust html]$ rmdir phpservermon-3.5.2
[isabell@stardust html]$
Configuration
Create the database, copy the configuration template and edit the config.php
file with your SQL credentials.
[isabell@stardust html]$ mysql -e "CREATE DATABASE ${USER}_psm"
[isabell@stardust html]$ cp config.php.sample config.php
[isabell@stardust html]$
After the installation you need to open isabell.uber.space in your browser to finish your setup.
- Fill out your system settings, admin user and edit the following database settings:
PSM_DB_USER:
isabell
PSM_DB_PASS from your MySQL credentials
PSM_DB_NAME:
isabell_psm
Finally, configure a cronjob: Add the following line to your crontab using the crontab -e command:
* * * * * /usr/bin/php /var/www/virtual/$USER/html/cron/status.cron.php
Updates
Check PHP Server Monitor’s stable releases for the latest versions. If a newer version is available, you should manually update your installation.
Backup your config.php
file, delete everything else in your html
directory.
[isabell@stardust ~]$ cd /var/www/virtual/$USER/html/
[isabell@stardust html]$ cp config.php ~
[isabell@stardust html]$ rm -rf * .*
Proceed with the installation steps from here and move back your config file.
[isabell@stardust html]$ mv ~/config.php ./
[isabell@stardust html]$
Finish the update by open isabell.uber.space in your browser.
Tested with PHP Server Monitor v3.5.2, PHP 8.1 and Uberspace 7.13.0
Written by: Thomas Johnson <https://johnson.tj/>