Skip to content

Instantly share code, notes, and snippets.

@arvenil
Last active June 18, 2017 00:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arvenil/a4ae344eceb6e4d3141c9fc92ccdcbbc to your computer and use it in GitHub Desktop.
Save arvenil/a4ae344eceb6e4d3141c9fc92ccdcbbc to your computer and use it in GitHub Desktop.
`mongodb:queries` doesn't enable `Profiling` for `MongoDB server`

mongodb:queries doesn't enable Profiling for MongoDB server

pmm-admin add mongodb:queries doesn't enable Profiling for MongoDB server so it may leave user confused why queries are not monitored, or in other words, why graphs are empty. He will also need to enable Profiling for every database he wants to monitor so this might me unnecessary overhead for the user.

Solution 1

Document how to Enable Database Profiling and Set the Profiling Level for all databases.

For example

$ mongo --quiet --eval '
        db.getMongo().getDBNames().forEach(function(dbname) {
                r = db.getSiblingDB(dbname).setProfilingLevel(2)
                print("db:", dbname)
                print(JSON.stringify(r))
                print()
        });
'
db: admin
{"was":0,"slowms":100,"ok":1}

db: local
{"was":0,"slowms":100,"ok":1}

db: samples
{"was":0,"slowms":100,"ok":1}

db: test
{"was":0,"slowms":100,"ok":1}

Solution 2

Enable Database Profiling and Set the Profiling Level automatically with some safe defaults (e.g. slow queries only) while user adds monitor with pmm-admin, later he can fine tune it manually.

Solution 3

Enable Database Profiling and Set the Profiling Level automatically if flag --auto-set-profiling-level is set and parameters were provided. This will allow user to decide if Profiling should be enabled automatically or not and with what defaults (e.g. slow queries only, or all queries, or all queries but with Percona's rate limiting).

Solution ???

Let me know if you have other ideas and feel free to add them here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment