Skip to content

Instantly share code, notes, and snippets.

@jonatw
Created June 6, 2012 10:28
Show Gist options
  • Save jonatw/2881184 to your computer and use it in GitHub Desktop.
Save jonatw/2881184 to your computer and use it in GitHub Desktop.
connections and load average monitor script
<?php
//usage
//# watch "php monitor.php >> ./server_load_log"
$script_connection_count = 'netstat -an | grep 3306 | wc -l';
$script_load_avg = 'uptime';
$load_avg_result = exec($script_load_avg);
$connection_count = exec($script_connection_count);
echo $load_avg_result . ', connections: ' . $connection_count . "\n";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment