This is an automated email from the ASF dual-hosted git repository.

zhaoqingran pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hertzbeat.git


The following commit(s) were added to refs/heads/master by this push:
     new 4b010e6523 [monitoring-template] feat(mysql): add database account 
expiry metrics (#3969)
4b010e6523 is described below

commit 4b010e652350fc2c3d4f77a938ee6dccb5c0a758
Author: N.Bhanu Prasad <[email protected]>
AuthorDate: Sun Jan 18 19:59:03 2026 +0530

    [monitoring-template] feat(mysql): add database account expiry metrics 
(#3969)
    
    Co-authored-by: Logic <[email protected]>
    Co-authored-by: Duansg <[email protected]>
---
 .../src/main/resources/define/app-mysql.yml        | 66 ++++++++++++++++++++++
 home/docs/help/mysql_account_expiry.md             | 24 ++++++++
 2 files changed, 90 insertions(+)

diff --git a/hertzbeat-manager/src/main/resources/define/app-mysql.yml 
b/hertzbeat-manager/src/main/resources/define/app-mysql.yml
index 669c104ac9..cbe4c951f7 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 0000000000..ad1cc270c9
--- /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            |


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to