A WordPress plugin for adding a non-cacheable REST API endpoint to your website that can be used to monitor its uptime.
wp-uptime-monitor-rest-api-endpoint
directory to your /wp-content/mu-plugins/
directory.https://example.com/wp-json/uptime-monitor/v1/check
.Send a GET request to https://example.com/wp-json/uptime-monitor/v1/check
to monitor the uptime of your website.
On successful communication with your website and the underlying database, the REST API will respond with "status" set to "online" and the current datetime "timestamp". The datetime format will be reflective of your SQL server's NOW() function output format.
If the website's server is not reachable or the database is inaccessible, you will receive an error message with HTTP status 503.
The code is available under the MIT License.