[BE] Can't remove monitoring endpoint

Description

When deleting a monitoring instance, even without any DB cluster created, the API returns the following error:

Failed to check the monitoring instance is used

Environment

None

Activity

peter.szczepaniak January 23, 2024 at 2:05 PM

Discussed with Let’s follow option “yes” we should allow to monitor dbs only

Michal January 22, 2024 at 11:26 AM

we started to properly handle an error when we could not find monitoring resources in the cluster.

Per Diogo’s message - what would be the expected behavior for monitoring if the monitoring resources are not available?

Diogo Recharte January 18, 2024 at 4:57 PM

I just figured out how to replicate this and what’s causing the issue.

In order to replicate this, you must NOT run everestctl monitoring enable. Just get a fresh everest install without monitoring enabled and add a monitoring instance using the UI or BE API. Then if you try to delete that same instance you’ll get the following error:

 

This happens because before deleting a monitoring instance we check if it’s being used somewhere. Somewhere can be either a DBC or the VMOperator that pushes the k8s metrics to PMM.

If we have never installed the VMOperator we can’t check it’s config to know if it’s using the given instance.

 

Having said this, I see 2 possible solutions depending on a product question. Do we want users to be able to use the monitoring instances for DBC monitoring without having the k8s metrics flowing?
* Yes: then we shouldn’t assume that the VMOperator is installed and consequently we shouldn’t fail if we can’t get it’s config to verify if the monitoring instance is in use.
* No: then we shouldn’t allow monitoring instances to be added in the first place. We should guide the user into installing the VMOperator by running `everestctl monitoring enable`, only then the user should be allowed to add monitoring instances.

Michal January 16, 2024 at 2:39 PM

I can’t replicate this. When I create a monitoring instance and delete it afterwards, I get HTTP 204 as expected.

Can you help me figure out how to replicate?

Done

Details

Assignee

Reporter

Sprint

Fix versions

Affects versions

Priority

Smart Checklist

Created December 29, 2023 at 2:03 PM
Updated January 31, 2024 at 6:22 AM
Resolved January 31, 2024 at 6:22 AM