Skip to content

Instantly share code, notes, and snippets.

@m0veax
Created March 19, 2019 09:08
Show Gist options
  • Save m0veax/54c64225df8279d0dab9b651693537af to your computer and use it in GitHub Desktop.
Save m0veax/54c64225df8279d0dab9b651693537af to your computer and use it in GitHub Desktop.
Small improved MySQL Process Monitor
<html>
<head>
<meta http-equiv="refresh" content="10">
</head>
<body>
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
$PDO = new PDO("mysql:host=hostname;charset=utf8", "user", "password");
?>
<button onclick="window.stop();">Prevent Reload</button>
<br/><br/>
<table border="1">
<tr>
<td>ID</td>
<td>USER</td>
<td>HOST</td>
<td>DB</td>
<td>COMMAND</td>
<td>TIME</td>
<td>STATE</td>
<td>INFO</td>
</tr>
<?php
foreach($PDO->query('SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST order by USER, TIME') as $row) {
?>
<tr>
<td><?=$row['ID']?></td>
<td><?=$row['USER']?></td>
<td><?=$row['HOST']?></td>
<td><?=$row['DB']?></td>
<td><?=$row['COMMAND']?></td>
<td><?=$row['TIME']?></td>
<td><?=$row['STATE']?></td>
<td><?=$row['INFO']?></td>
</tr>
<?php
}
?>
</table>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment