MySQL 状态 metricset

编辑

MySQL status metricset 通过运行 SHOW GLOBAL STATUS; SQL 查询来收集 MySQL 数据。此查询返回大量指标。

raw 配置选项

编辑

此功能处于技术预览阶段,可能在将来的版本中更改或删除。Elastic 将努力修复任何问题,但技术预览中的功能不受正式 GA 功能的支持 SLA 的约束。

MySQL 状态 Metricset 支持 raw 配置选项。启用后,除了现有数据结构外,还将通过 "SHOW /*!50002 GLOBAL */ STATUS;" 从 MySQL 服务获取的所有字段添加到事件中。

这些字段将添加到 mysql.status.raw 命名空间下。字段可能因不同的 MySQL 实例而异,并且不保证字段映射,因为映射是动态发生的。此选项适用于高级用例。

这是一个默认 metricset。如果主机模块未配置,则默认启用此 metricset。

字段

有关 metricset 中每个字段的描述,请参阅导出字段 部分。

以下是此 metricset 生成的示例文档

{
    "@timestamp": "2020-07-13T16:36:00.626Z",
    "@metadata": {
        "beat": "metricbeat",
        "type": "_doc",
        "version": "8.0.0"
    },
    "agent": {
        "version": "8.0.0",
        "ephemeral_id": "d9d0d455-c440-453e-aea3-3b6fa512f6f3",
        "id": "803dfdba-e638-4590-a2de-80cb1cebe78d",
        "name": "mcastro",
        "type": "metricbeat"
    },
    "mysql": {
        "status": {
            "connections": 28,
            "threads": {
                "running": 2,
                "cached": 1,
                "created": 4,
                "connected": 3
            },
            "innodb": {
                "rows": {
                    "updated": 0,
                    "deleted": 0,
                    "inserted": 0,
                    "reads": 0
                },
                "buffer_pool": {
                    "write_requests": 1634,
                    "bytes": {
                        "data": 15908864,
                        "dirty": 0
                    },
                    "pages": {
                        "data": 971,
                        "dirty": 0,
                        "flushed": 144,
                        "free": 7216,
                        "misc": 5,
                        "total": 8192
                    },
                    "read": {
                        "requests": 15600,
                        "ahead": 0,
                        "ahead_evicted": 0,
                        "ahead_rnd": 0
                    },
                    "pool": {
                        "reads": 830,
                        "wait_free": 0
                    }
                }
            },
            "handler": {
                "update": 315,
                "read": {
                    "rnd_next": 394983,
                    "first": 33,
                    "key": 2100,
                    "last": 0,
                    "next": 4533,
                    "prev": 0,
                    "rnd": 2494
                },
                "write": 168505,
                "mrr_init": 0,
                "delete": 0,
                "external_lock": 8167,
                "savepoint_rollback": 0,
                "rollback": 0,
                "commit": 625,
                "savepoint": 0,
                "prepare": 0
            },
            "bytes": {
                "sent": 6228481,
                "received": 143324
            },
            "created": {
                "tmp": {
                    "tables": 364,
                    "disk_tables": 0,
                    "files": 5
                }
            },
            "binlog": {
                "cache": {
                    "disk_use": 0,
                    "use": 0
                }
            },
            "connection": {
                "errors": {
                    "max": 0,
                    "peer_address": 0,
                    "select": 0,
                    "tcpwrap": 0,
                    "accept": 0,
                    "internal": 0
                }
            },
            "delayed": {
                "errors": 0,
                "insert_threads": 0,
                "writes": 0
            },
            "max_used_connections": 4,
            "opened_tables": 195,
            "queries": 1183,
            "flush_commands": 3,
            "command": {
                "insert": 0,
                "select": 705,
                "update": 0,
                "delete": 0
            },
            "aborted": {
                "clients": 0,
                "connects": 2
            },
            "cache": {
                "table": {
                    "open_cache": {
                        "hits": 3889,
                        "misses": 195,
                        "overflows": 0
                    }
                },
                "ssl": {
                    "size": 128,
                    "hits": 0,
                    "misses": 0
                }
            },
            "questions": 1173,
            "open": {
                "streams": 0,
                "tables": 116,
                "files": 2
            }
        }
    },
    "event": {
        "dataset": "mysql.status",
        "module": "mysql",
        "duration": 1871014
    },
    "metricset": {
        "name": "status",
        "period": 10000
    },
    "service": {
        "address": "172.17.0.2:3306",
        "type": "mysql"
    },
    "ecs": {
        "version": "1.5.0"
    },
    "host": {
        "name": "mcastro"
    }
}