Skip to content

fix(mongodb): fix total queries output#6110

Open
tseeker wants to merge 1 commit intocentreon:developfrom
tseeker:eb-20260408-fix-mongodb-queries-total-output
Open

fix(mongodb): fix total queries output#6110
tseeker wants to merge 1 commit intocentreon:developfrom
tseeker:eb-20260408-fix-mongodb-queries-total-output

Conversation

@tseeker
Copy link
Copy Markdown

@tseeker tseeker commented Apr 9, 2026

Community contributors

Description

This commit fixes the output of total queries so that the actual count is displayed as such, and adds a working per-second output.

Type of change

  • Patch fixing an issue (non-breaking change)
  • New functionality (non-breaking change)
  • Functionality enhancement or optimization (non-breaking change)
  • Breaking change (patch or feature) that might cause side effects breaking part of the Software

How this pull request can be tested ?

Running the plugin in queries mode will add a total count output (and a corresponding queries.total.count metric) with the actual amount of requests, while the queries.total.persecond metric and Requests total output will contain the per-second values.

Before the fix:

# /usr/lib/centreon/plugins/centreon_mongodb.pl --plugin database::mongodb::plugin --hostname ... --username ... --password ... --mode=queries
OK: Requests total: 98 | 'queries.total.persecond'=98/s;;;0; 'queries.insert.persecond'=0.00/s;;;0; 'queries.insert.count'=0;;;0; 'queries.query.persecond'=96.35/s;;;0; 'queries.query.count'=1638;;;0; 'queries.update.persecond'=0.00/s;;;0; 'queries.update.count'=0;;;0; 'queries.delete.persecond'=0.00/s;;;0; 'queries.delete.count'=0;;;0; 'queries.getmore.persecond'=0.24/s;;;0; 'queries.getmore.count'=4;;;0; 'queries.command.persecond'=1.41/s;;;0; 'queries.command.count'=24;;;0;

After the fix:

# /usr/lib/centreon/plugins/centreon_mongodb.pl --plugin database::mongodb::plugin --hostname ... --username ... --password ... --mode=queries
OK: Requests total: 1.57/s, total count: 22 | 'queries.total.persecond'=1.57/s;;;0; 'queries.total.count'=22;;;0; 'queries.insert.persecond'=0.00/s;;;0; 'queries.insert.count'=0;;;0; 'queries.query.persecond'=0.00/s;;;0; 'queries.query.count'=0;;;0; 'queries.update.persecond'=0.00/s;;;0; 'queries.update.count'=0;;;0; 'queries.delete.persecond'=0.00/s;;;0; 'queries.delete.count'=0;;;0; 'queries.getmore.persecond'=0.14/s;;;0; 'queries.getmore.count'=2;;;0; 'queries.command.persecond'=1.43/s;;;0; 'queries.command.count'=20;;;0;

Checklist

  • I have followed the coding style guidelines provided by Centreon
  • I have commented my code, especially hard-to-understand areas of the PR.
    • there isn't much to comment here
  • I have rebased my development branch on the base branch (develop).
    • branched from fresh clone
  • I have provide data or shown output displaying the result of this code in the plugin area concerned.

Summary by Aikido

Security Issues: 0 Quality Issues: 0 Resolved Issues: 0

⚡ Enhancements

  • Added separate total-count metric for absolute total query counts
  • Updated per-second perfdata templates to use two-decimal formatting

🐛 Bugfixes

  • Fixed total queries output to display correct per-second value

More info

This commit fixes the output of total queries so that the actual count
is displayed as such, and adds a working per-second output.
@tseeker tseeker requested a review from a team as a code owner April 9, 2026 06:41
@tseeker tseeker requested a review from scresto31 April 9, 2026 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants