Docker
StackState Self-hosted v5.1.x
Overview
This page will walk you through the steps required to successfully migrate from Agent V1 (legacy) to Agent V2. This migration process will also migrate the existing Agent V1 (legacy) state. This will allow Agent checks, such as Splunk topology, metrics or event checks, to continue on Agent V2 from their previous state.
The migration process steps detailed below must be carried out in the correct order.
Problems can occur if any of the steps is completed out of order. This could result in overwritten Agent state files, invalid Agent state files or a broken Agent V2 instance.
It's highly recommended to run this migration in a test environment.
It may affect some steps below, but will reduce the initial impact if something doesn't run to plan.
Impact analysis
Downtime
Running Agent V1 (legacy) and Agent V2 at the same time on a single machine will result in missing data. For this reason, StackState Agent will need to be down for the entire of the migration process. The exact length of time required to complete the migration process will vary depending on your specific environment and the number of Agent checks that need to be migrated.
Performance
Switching from Agent V1 (legacy) to Agent V2 can either increase or decrease the number of resources used. Unlike Agent V1 (legacy), Agent V2 allows for synchronous execution of checks. This provides a better StackState experience, but may result in increased resource requirements.
Migration process - Docker-Compose
1. Stop Agent V1 (legacy)
Agent V1 (legacy) must be stopped before proceeding with the Agent V2 install and Agent V1 state migration.
If Agent V1 (legacy) is still running, it might interfere with the installation process of Agent V2 or, even worse, break the Agent V2 state.
You can stop Agent V1 (legacy) with the following command:
After the Agent has been stopped, verify its status with:
2. Create a Docker-Compose volume snippet of the conf.d files
For this step, you won't physically run or create any Docker volumes, but you need to create a snippet of Docker volumes that will be appended inside your docker-compose file.
To compile a list of all the conf.d Docker volumes, do the following:
Go to the directory
/etc/sts-agent/conf.d/
.For each file in the directory, compile a list of volumes. For example, the files used for the Agent V1 (legacy) Splunk checks (Splunk Events, Splunk Metrics and Splunk Topology V1) are shown below:
File 1:
/etc/sts-agent/conf.d/splunk_topology.yaml
File 2:
/etc/sts-agent/conf.d/splunk_event.yaml
- add to the existing list:
File 3:
/etc/sts-agent/conf.d/splunk_metric.yaml
- add to the existing list:
Keep the above snippet on the side, we will use it in the Docker-Compose file.
This step is only required if you have Splunk Topology Check enabled
Note that this will break the splunk_topology.yaml
check configuration for Agent V1 (legacy).
Edit the check configuration file
/etc/sts-agent/conf.d/splunk_topology.yaml
and replace all occurrences of the following items:default_polling_interval_seconds
replace withcollection_interval
polling_interval_seconds
replace withcollection_interval
3. Add the Agent State directory to your volume snippet
Take the list of volumes you created in step 2 and add one additional line for the Agent State. This will allow us to migrate the existing Agent V1 (legacy) State to the new Agent V2 Docker Container.
Add the following line
If we look at the splunk example from the previous step, it will look as follows:
Keep the above snippet on the side, we will use it in the Docker-Compose file.
4. Migrate the Agent V1 (legacy) cache
Migrating the Agent V1 (legacy) cache requires a cache conversion process. This is a manual process that StackState will assist you with. Contact StackState support to assist with this process.
A breakdown of the steps that will happen in the cache migration is as follows:
Back up the Agent V1 (legacy) cache folder from the following location
/opt/stackstate-agent/run/
.Run the Agent V1 (legacy) cache migration process.
The output of the cache migration process will be moved into the Agent V2 cache directory. Depending on the installation, some steps may need to be completed manually.
5. Install and start Agent V2
To run StackState Agent V2 with Docker compose:
Add the following configuration to the compose file on each node where the Agent will run.
<STACKSTATE_RECEIVER_API_KEY>
is set during StackState installation.<STACKSTATE_RECEIVER_API_ADDRESS>
is specific to your installation of StackState.<THE_VOLUME_SNIPPET_YOU_CREATED>
this is the volume snippet you created in step 2 and 3.
Example with Splunk included and the Agent V1 (legacy) state directory:
Run the command
Migration process - Docker single container
1. Stop Agent V1 (legacy)
Agent V1 (legacy) will have to be stopped before proceeding with the Agent V2 install and Agent V1 state migration.
If Agent V1 (legacy) is still running, it might interfere with the installation process of Agent V2 or, even worse, break the Agent V2 state.
You can stop Agent V1 (legacy) with the following command:
After the Agent has been stopped, verify its status with:
2. Create a Docker-Compose volume snippet of the conf.d files
For this step, you won't physically run or create any docker volumes, but you need to create a snippet of docker volumes that will be appended inside your docker run command.
To compile a list of all the conf.d docker volumes, do the following:
Go to the directoty
/etc/sts-agent/conf.d/
For each file inside the folder, compile a list of volumes. For example, if we use Splunk as the example (Remember to add a \ on the ending of each line):
File 1:
/etc/sts-agent/conf.d/splunk_topology.yaml
File 2:
/etc/sts-agent/conf.d/splunk_event.yaml
- add to the existing list:
File 3:
/etc/sts-agent/conf.d/splunk_metric.yaml
- add to the existing list:
Keep the above snippet on the side, we will use it in the
docker run
command.
This step is only required if you have Splunk Topology Check enabled
Note that this will break the splunk_topology.yaml
check configuration for Agent V1 (legacy).
Edit the check configuration file
/etc/sts-agent/conf.d/splunk_topology.yaml
and replace all occurrences of the following items:default_polling_interval_seconds
replace withcollection_interval
polling_interval_seconds
replace withcollection_interval
3. Add the Agent State directory into your volume snippet
Take the list of volumes you created in step 2 and add one additional line for the Agent State. This will allow us to migrate the existing Agent V1 (legacy) State to the Agent V2 Docker Container.
Add the following line (Remember to add a \ on the ending of each line)
If we take the Splunk example from the previous step, it will look as follows:
Now that you have the snippet above keep it on the side, we will use it in the docker run command
4. Migrate the Agent V1 (legacy) cache
Migrating the Agent V1 (legacy) cache requires a cache conversion process, and this is a manual process that StackState will assist you with. Contact StackState to assist with this process.
A breakdown of the steps that will happen in the cache migration is as follows:
Back up the Agent V1 (legacy) cache folder from the following location
/opt/stackstate-agent/run/
.Run the Agent V1 (legacy) cache migration process.
The output of the cache migration process will either be manually moved into the Agent V2 cache directory or automatically, depending on the conversion process used for Agent V2 (Some steps, depending on the installation, can only be done manually).
5. Install and Start Agent V2
To start a single Docker container with StackState Agent V2, run the command below.
Add the following configuration to the compose file on each node where the Agent will run.
<STACKSTATE_RECEIVER_API_KEY>
is set during StackState installation.<STACKSTATE_RECEIVER_API_ADDRESS>
is specific to your installation of StackState.<ADD_YOUR_VOLUME_SNIPPET_YOU_CREATED_HERE>
this is the volume snippet you created in step 2 and 3.
Example with Splunk Included and the Agent V1 (legacy) State Directory
Splunk Health check
In addition to the Splunk Topology, Splunk Metrics and Splunk Events checks, StackState Agent V2 can also be configured to run a Splunk Health check to collect health data from Splunk.
Last updated