Add/ change environment parameter for existing service

It there are way to set Environment tag for existing agent service ?

1 Like

Hi Pavel,

What kind of environment variable you want to tune in particular, and for what component exactly?
What method of deployment are you using?

1 Like

I meand Environment on services

We add MySQL services by this command
pmm-admin add mysql --username=*** --password=*** --environment=SOME_ENV

And after we add services i can not find way to change environment for existing service

1 Like

Understood, thanks for elaborating on it.

There is no way to update that (at least for now). You will have to remove and readd the exporter.
For example, for MySQL:

pmm-admin remove mysql <service_name>
pmm-admin add mysql [other_arguments] --environment=<name> [positional_arguments]

Note that if you use the same service_name while readding it, you won’t lose the historic metrics associated with it, but you will see a gap without metrics from the time between the remove and add commands.

1 Like

Thank you. It helps. I checked on one service and after this i see service in correct environment, but after this i see this service in two environments
in old environment
in new environment

1 Like

This will happen until the old metrics (gathered while using the old environment value) phase out after the retention time, which by default is 30 days.

The latest metrics should have the new environment, and the metrics gathered before doing the remove/add procedure will have the old one.

After 30 days, you will only see the new environment.