Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
ycg
Python-Tools
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
Python-Tools
/
mysql_monitor_server.py
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
37 lines (30 loc) · 1.58 KB
master
Breadcrumbs
Python-Tools
/
mysql_monitor_server.py
Copy path
Top
File metadata and controls
Code
Blame
37 lines (30 loc) · 1.58 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# -*- coding: utf-8 -*-
'''
#1.提高在后台一直监测数据库,最基本的监控mysql status
#2.提供监测磁盘的功能,比如单表增长过快,需要进行邮件提醒
#3.提供本地客户端登录,也就是链接数据库即可
#4.所有的监控数据都进行入库处理
#5.支持指定cpu或者线程数大于多少记录mysql信息,如果processlist trx innodb status等等
#6.提供各种命令状态去查看数据库情况
1.增长最快的前十个表
2.表体积最大的前十个表
3.各种资源利用率的前十数据
4.数据库体积前十
select table_schema, table_name, concat(round(data_length/1024/1024,2), "M") as 数据大小
from information_schema.tables
where table_schema != 'mysql' and table_schema != 'information_schema' and table_schema != 'performation_schema'
and data_length > 1024 * 1024 * 100 order by data_length desc limit 100;
select table_schema, table_name, concat(round(index_length/1024/1024,2), "M") as 索引大小
from information_schema.tables
where table_schema != 'mysql' and table_schema != 'information_schema' and table_schema != 'performation_schema'
and index_length > 1024 * 1024 * 100 order by index_length desc limit 100;
1.每次获取status之后就通过线程把数据写入到数据库
二丶各种邮件报表
1.数据的增长量
比如表体积前20的表数据
比如一天表数据增长的前20个表
2.数据库总的报表
磁盘占用,mysql数据总大小
3.统计磁盘碎片
数据库查询数据大小+索引大小 - 跟硬盘文件大小做对比
'''
You can’t perform that action at this time.