Package: insidepostgresql
InsidePostgreSQL PackageThis Python package provides functionality to interact with a PostgreSQL database and perform various checks and calculations. It includes the following features:Connection to a PostgreSQL databaseChecking for inactive replication slotsChecking for long-running queriesCounting active sessionsCalculating table bloat ratioChecking the last analyze and autovacuum dates for tablesChecking node and postgresql exporter endpointsChecking average lock count on databaseGetting Startedpip3installinsidepostgresqlimportpostgresqldb=postgresql.PostgreSQL("172.17.0.2","demo","test123","test")+------------------------------------------+----------+----------------------------------------------------------------------------------------------------+
| Issue                                    | Result   | Description                                                                                        |
+==========================================+==========+====================================================================================================+
| Connected To PostgreSQL                  | ✓        | PostgreSQL connection test.                                                                        |
+------------------------------------------+----------+----------------------------------------------------------------------------------------------------+
| Long Running Query                       | ✓        | There is no running query older than 1 minute                                                      |
+------------------------------------------+----------+----------------------------------------------------------------------------------------------------+
| Sum of Active Sessions < 50              | ✓        | Active session count is less than 50                                                               |
+------------------------------------------+----------+----------------------------------------------------------------------------------------------------+
| Average Important Lock Count < 10        | ✓        | Average of RowExclusiveLock,ShareUpdateExclusiveLock,ShareLock,AccessExclusiveLock is less than 10 |
+------------------------------------------+----------+----------------------------------------------------------------------------------------------------+
| Last Analyze/Autovacuum in the Last Week | ✓        | All tables are maintained this week.                                                               |
+------------------------------------------+----------+----------------------------------------------------------------------------------------------------+
| No Bloat Table Exists                    | ✓        | There is no table with bloat ratio greater than 50                                                 |
+------------------------------------------+----------+----------------------------------------------------------------------------------------------------+
| No Inactive Replication Slot             | ✓        | All replication slots are working and active.                                                      |
+------------------------------------------+----------+----------------------------------------------------------------------------------------------------+
| Node Exporter Working                    | ✗        | Node exporter are working and running                                                              |
+------------------------------------------+----------+----------------------------------------------------------------------------------------------------+
| PostgreSQL Exporter Working              | ✗        | PostgreSQL exporter are working and running                                                        |
+------------------------------------------+----------+----------------------------------------------------------------------------------------------------+ContributingIf you would like to contribute to insidepostgresql, please submit a pull request with your changes. Before submitting a pull request, please make sure that your changes are properly tested and documented.LicenseInsideCouchbase is licensed under the MIT license. See the LICENSE file for more information.