diff --git a/hertzbeat-manager/src/main/resources/define/app-mysql.yml b/hertzbeat-manager/src/main/resources/define/app-mysql.yml index 669c104ac93..cbe4c951f7d 100644 --- a/hertzbeat-manager/src/main/resources/define/app-mysql.yml +++ b/hertzbeat-manager/src/main/resources/define/app-mysql.yml @@ -1178,3 +1178,69 @@ metrics: privateKey: ^_^sshPrivateKey^_^ privateKeyPassphrase: ^_^sshPrivateKeyPassphrase^_^ shareConnection: ^_^sshShareConnection^_^ + - name: account_expiry + priority: 100 + i18n: + zh-CN: 数据库账号有效期 + en-US: Account Expiry + ja-JP: アカウント有効期限 + fields: + - field: user + type: 1 + label: true + i18n: + zh-CN: 用户 + en-US: User + ja-JP: ユーザー + - field: host + type: 1 + label: true + i18n: + zh-CN: 主机 + en-US: Host + ja-JP: ホスト + - field: days_left + type: 0 + i18n: + zh-CN: 剩余天数 + en-US: Days Left + ja-JP: 残り日数 + - field: password_expired + type: 1 + i18n: + zh-CN: 是否已过期 + en-US: Password Expired + ja-JP: 期限切れ + + protocol: jdbc + jdbc: + host: ^_^host^_^ + port: ^_^port^_^ + platform: mysql + username: ^_^username^_^ + password: ^_^password^_^ + database: mysql + timeout: ^_^timeout^_^ + queryType: multiRow + sql: | + SELECT + user, + host, + IF(password_lifetime IS NULL, + NULL, + password_lifetime - DATEDIFF(NOW(), password_last_changed) + ) AS days_left, + password_expired + FROM mysql.user; + url: ^_^url^_^ + sshTunnel: + enable: ^_^enableSshTunnel^_^ + host: ^_^sshHost^_^ + port: ^_^sshPort^_^ + timeout: ^_^sshTimeout^_^ + username: ^_^sshUsername^_^ + password: ^_^sshPassword^_^ + privateKey: ^_^sshPrivateKey^_^ + privateKeyPassphrase: ^_^sshPrivateKeyPassphrase^_^ + shareConnection: ^_^sshShareConnection^_^ + diff --git a/home/docs/help/mysql_account_expiry.md b/home/docs/help/mysql_account_expiry.md new file mode 100644 index 00000000000..ad1cc270c94 --- /dev/null +++ b/home/docs/help/mysql_account_expiry.md @@ -0,0 +1,24 @@ +--- +id: mysql_account_expiry +title: "Monitoring: MySQL Account Expiry" +sidebar_label: "MySQL Account Expiry" +keywords: + - mysql account expiry + - mysql password expiration + - mysql security monitoring +--- + +> Monitor MySQL database account password expiration information. + +### Collection Metric + +#### Metric set:account_expiry + +| Metric name | Metric unit | Metric help description | +|-----------------------|-------------|------------------------------------------------------| +| user | none | MySQL account username | +| host | none | Host from which the account is allowed to connect | +| password_lifetime | day | Password validity period in days | +| password_last_changed | timestamp | Time when the password was last changed | +| password_expired | none | Whether the account password is expired (true/false) | +| days_left | day | Remaining days before password expiration |