I want to setup alerting for slow queries for mongodb . Can anybody tell me the steps
Hi Pramod_Kumar_Gupta,
Setting up alerts for slow queries is not possible but you can consider creating alerts for other dashboards for high server load.
To create alerts you need to have PMM 2.31 or newer and follow the steps from here: About Percona Alerting - Percona Monitoring and Management
Regards
Hi @Pramod_Kumar_Gupta,
it’s not tested, but you can try to setup alerting for mongodb_profile_slow_query_count
metric. Maybe it’s what you are looking for.
Setting up alerting for slow queries in MongoDB involves a few steps. Here’s a guide to get you started:
- Configure Slow Query Logging:
- Edit your MongoDB configuration file (usually
mongod.conf
). - Enable slow query logging by setting the
slowOpThresholdMs
parameter to the desired threshold (e.g., 100ms).
yaml
operationProfiling:
slowOpThresholdMs: 100
- Use a Monitoring Tool:
- Tools like Percona Monitoring and Management (PMM) can help capture slow query logs.
- Install PMM and connect it to your MongoDB instance.
- Create Alerts:
- In PMM, navigate to the monitoring dashboard and set up alerts for slow queries.
- Customize alert rules based on your slow query log data (e.g., queries taking longer than 100ms).
By following these steps, you can effectively monitor and receive alerts for slow queries in MongoDB. Let me know if you have any questions or need further details!
Best of luck!
that is what how to implement this in pmm . Which metric will expose this . Or which panel in mongodb dasboard shows this so that i can create an alert on it
It’s a metric name, it’s not used by PMM yet.