Skip to content

Instantly share code, notes, and snippets.

@sburlot
Created April 23, 2024 08:20
Show Gist options
  • Save sburlot/5cb9e0b30a8dd9ee0599ce0ead284728 to your computer and use it in GitHub Desktop.
Save sburlot/5cb9e0b30a8dd9ee0599ce0ead284728 to your computer and use it in GitHub Desktop.
Check if your hosting server has too much activity
<?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;
?>
@sburlot
Copy link
Author

sburlot commented Apr 23, 2024

Tested on KreativMedia.ch, Infomaniak.com, Hostpoint.ch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment