PHP Server Monitor

PHP Server Monitor is an open source tool to monitor your servers and websites.


Note

For this guide you should be familiar with the basic concepts of

Prerequisites

We’re using PHP in the stable version 7.2:

[isabell@stardust ~]$ uberspace tools version show php
Using 'PHP' version: '7.2'
[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.4.5/phpservermon-3.4.5.zip
[isabell@stardust html]$ unzip phpservermon-3.4.5.zip
[isabell@stardust html]$ rm phpservermon-3.4.5.zip
[isabell@stardust html]$ mv phpservermon-3.4.5/* phpservermon-3.4.5/.* ./
[isabell@stardust html]$ rmdir phpservermon-3.4.5
[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.4.5 and Uberspace 7.4

Written by: Thomas Kammerer <https://kammerer.tk/>