Giter VIP home page Giter VIP logo

go-mysql-exporter's Introduction

go-mysql-exporter

build-test GoDoc

golang mysql-exporter demo, Learn to develop exporter as the goal.

Download

  • download
curl -Lfs -o main https://github.com/xiexianbin/go-mysql-exporter/releases/latest/download/mysql-exporter-{linux|darwin|windows}
chmod +x mysql-exporter
./mysql-exporter

Help

$ mysql-exporter -h
Usage: mysql-exporter -addr 0.0.0.0:9306 -mysqlAddr 127.0.0.1:3306 -u root -p root -d mysql
  -addr string
    	server url (default "0.0.0.0:9306")
  -d string
    	mysql db (default "mysql")
  -help
    	show help message
  -mysqlAddr string
    	mysql url (default "127.0.0.1:3306")
  -p string
    	mysql password (default "root")
  -u string
    	mysql user (default "root")
  -v	version info

mysql monitor sql

Only part of the function is realized

mysql> show global status where variable_name like "%slow%";
+---------------------+-------+
| Variable_name       | Value |
+---------------------+-------+
| Slow_launch_threads | 0     |
| Slow_queries        | 0     |
+---------------------+-------+
2 rows in set (0.02 sec)
mysql> show global status where variable_name like "%queries%";
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Queries       | 9513  |
| Slow_queries  | 0     |
+---------------+-------+
2 rows in set (0.01 sec)
mysql> show global status where variable_name like "com_%";
+-------------------------------------+-------+
| Variable_name                       | Value |
+-------------------------------------+-------+
...
| Com_delete                          | 4     |
| Com_delete_multi                    | 0     |
| Com_insert                          | 182   |
| Com_insert_select                   | 0     |
| Com_select                          | 2937  |
| Com_update                          | 10    |
| Com_update_multi                    | 0     |
...
mysql> show global status where variable_name like "thread%";
+-------------------+-------+
| Variable_name     | Value |
+-------------------+-------+
| Threads_cached    | 5     |
| Threads_connected | 1     |
| Threads_created   | 6     |
| Threads_running   | 2     |
+-------------------+-------+
4 rows in set (0.00 sec)
mysql> show global variables like "%connect%";
+-----------------------------------------------+----------------------+
| Variable_name                                 | Value                |
+-----------------------------------------------+----------------------+
| character_set_connection                      | utf8mb4              |
| collation_connection                          | utf8mb4_0900_ai_ci   |
| connect_timeout                               | 10                   |
| connection_memory_chunk_size                  | 8912                 |
| connection_memory_limit                       | 18446744073709551615 |
| disconnect_on_expired_password                | ON                   |
| global_connection_memory_limit                | 18446744073709551615 |
| global_connection_memory_tracking             | OFF                  |
| init_connect                                  |                      |
| max_connect_errors                            | 100                  |
| max_connections                               | 151                  |
| max_user_connections                          | 0                    |
| mysqlx_connect_timeout                        | 30                   |
| mysqlx_max_connections                        | 100                  |
| performance_schema_session_connect_attrs_size | 512                  |
+-----------------------------------------------+----------------------+
15 rows in set (0.08 sec)
mysql>  show global variables where variable_name = "max_connections";
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| max_connections | 151   |
+-----------------+-------+
1 row in set (0.00 sec)
mysql>  show global status where variable_name like "Bytes%";
+----------------+---------+
| Variable_name  | Value   |
+----------------+---------+
| Bytes_received | 1087895 |
| Bytes_sent     | 4168119 |
+----------------+---------+
2 rows in set (0.00 sec)
mysql>  show global status where variable_name like "open_%";
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| Open_files               | 2     |
| Open_streams             | 0     |
| Open_table_definitions   | 74    |
| Open_tables              | 499   |
| Opened_files             | 2     |
| Opened_table_definitions | 844   |
| Opened_tables            | 982   |
+--------------------------+-------+
7 rows in set (0.00 sec)

go-mysql-exporter's People

Contributors

xiexianbin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.