turanalmammadov opened a new pull request, #4040:
URL: https://github.com/apache/hertzbeat/pull/4040

   ## What does this PR do?
   
   Adds account expiry monitoring metrics for PostgreSQL, consistent with the 
pattern already used for Oracle, MariaDB, SQL Server, and TiDB.
   
   ### Changes
   
   - **`app-postgresql.yml`**: Added new `account_expiry` metric set that 
queries `pg_roles` for roles with a non-null `rolvaliduntil` value. Exposes:
     - `rolname` – role (user) name
     - `rolvaliduntil` – account expiration timestamp
     - `seconds_until_expiry` – seconds remaining until expiry (negative means 
already expired)
     - `rolcanlogin` – whether the role is permitted to log in
   
   - **`home/docs/help/postgresql.md`**: Added `account_expiry` metric set 
table (English)
   
   - **`home/i18n/zh-cn/.../postgresql.md`**: Added `account_expiry` metric set 
table (Chinese)
   
   ### Why is this needed?
   
   Monitoring password/account expiration helps DBAs proactively detect 
accounts about to expire and avoid unexpected authentication failures in 
production systems.
   
   ### Testing
   
   SQL query tested against PostgreSQL 14+:
   ```sql
   SELECT rolname, rolvaliduntil::text as rolvaliduntil,
          EXTRACT(EPOCH FROM (rolvaliduntil - now()))::bigint AS 
seconds_until_expiry,
          rolcanlogin::text as rolcanlogin
   FROM pg_roles
   WHERE rolvaliduntil IS NOT NULL
   ORDER BY rolvaliduntil ASC;
   ```
   
   Made with [Cursor](https://cursor.com)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to