Skip to content

Instantly share code, notes, and snippets.

@netmarkjp
Last active August 29, 2015 13:56
Show Gist options
  • Save netmarkjp/8986819 to your computer and use it in GitHub Desktop.
Save netmarkjp/8986819 to your computer and use it in GitHub Desktop.
select T_NOW.CONN / T_MAX.CONN * 100 as CONN_USAGE
from
( select 1 as k, VARIABLE_VALUE as CONN from information_schema.GLOBAL_STATUS where VARIABLE_NAME = 'Threads_connected' ) as T_NOW
join
(select 1 as k, VARIABLE_VALUE as CONN from information_schema.GLOBAL_VARIABLES where VARIABLE_NAME = 'max_connections' ) as T_MAX
on T_NOW.k = T_MAX.k
@netmarkjp
Copy link
Author

replication connections are not counted.

@netmarkjp
Copy link
Author

recommend: use with check_mysql_query

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