Created
April 23, 2024 08:20
-
-
Save sburlot/5cb9e0b30a8dd9ee0599ce0ead284728 to your computer and use it in GitHub Desktop.
Check if your hosting server has too much activity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Check if your hosting server has too much activity. | |
// I use it to check when my site is slow | |
// Drop it in your main directory and call it with curl | |
// curl "https://example.com/check_load_json.php" | |
// | |
// Returns the load avg as a json, so you can process it easily | |
// | |
// Stephan Burlot coriolis.ch Apr 2024 | |
// | |
// The number of significant digits stored while serializing floating point numbers. | |
// -1 means that an enhanced algorithm for rounding such numbers will be used. Set to 100 on KreativMedia. WTF | |
ini_set("serialize_precision", -1); | |
$load = sys_getloadavg(); | |
$data = json_encode($load); | |
echo $data; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tested on KreativMedia.ch, Infomaniak.com, Hostpoint.ch