Welcome, Guest Login

Support Center

Running the Google Stackdriver and Legacy Stackdriver agents together (Linux)

Last Updated: Jan 04, 2017 10:38AM EST

It is possible to create a second instance of the Stackdriver agent on your VM in order to send data from one machine to both Google Stackdriver and Legacy Stackdriver. This process is only necessary if you're looking to run both agents simultaneously for testing purposes.‚Äč Please take care to follow these instructions in the exact order they’re laid out. If you install the package before altering the copied sysconfig file, the agent start process will fail.

 

**Please ensure that your configurations for all third party plugins are up to date.

 

Step 1: Preparation

1. Create Google Stackdriver account. Connect AWS account.

2. Confirm that agent on machine is running latest version. Upgrade if necessary.

Step 2: Create a service account and generate a private key

The most comprehensive instructions on authorizing your new agent are on the Google Stackdriver documentation page. You can run straight through the steps here or follow along in the steps below. Make sure to stop before actually installing the agent:
1.
Create a service account for the project that houses your AWS account link.

2. Using scp or a different client, copy the private key generated from the new service account to your EC2 instance. Place the key at: /etc/google/auth/application_default_credentials.json

Step 3: Copy the sysconfig file

Your sysconfig file will be in one of two places depending on the linux distribution running on your instances.

 

1. Copy the appropriate file and prepend ‘gcm-’ in front on the copy’s name:

 

RHEL: /etc/sysconfig/stackdriver >> /etc/sysconfig/gcm-stackdriver

Debian: /etc/default/stackdriver-agent >> /etc/default/gcm-stackdriver-agent

 

**Once you’ve completed migration this configuration file can become your primary file by moving it back to either the /etc/sysconfig/stackdriver or /etc/default/stackdriver-agent name respectively.

Step 4: Download appropriate tarball

For your convenience, the scripts necessary to run the second agent have been encapsulated in the tarballs below. Simply untar the appropriate one in your root directory.

 

RHEL: http://repo.stackdriver.com/migration/stackdriver-migration-assist-1.0-1.rhel_noarch.tgz

Debian: http://repo.stackdriver.com/migration/stackdriver-migration-assist_1.0-1.debian_all.tgz

Step 5: Alter the sysconfig file and start the agent

Run the following command to adjust the second agent's path and start the second agent:

 

/opt/stackdriver/gcm-stack-config --write-gcm

 

 


Appendix: Manual Installation instructions

If you would rather alter your system manually, these instructions replace steps 4 and 5 above.

Agent config

The current agent can be configured to operate independently by making copies of and altering three files. Once you rename the files and their contents, you can start a new Google Stackdriver-ready agent service. To start make copies of the three files below:

  1. /etc/sysconfig/stackdriver [RHEL] OR /etc/default/stackdriver-agent [Debian] - This file controls the auto configuration script and should already exist.

  2. /etc/init.d/stackdriver-agent - This startup script will need to reference the renamed files (see below) you create in order to operate alongside the existing legacy account agent.

  3. /opt/stackdriver/stack-config - This python script will generate configuration files for the second agent and will need to have several paths changed.

IMPORTANT: You will also need to symlink the binary so that stopping one does not affect the other.  The binary is /opt/stackdriver/collectd/sbin/stackdriver-collectd and /opt/stackdriver/collectd/sbin/gcm-stackdriver-collectd is assumed the name of that symlink below.

Sysconfig file

You sysconfig file will be in one of two places depending on the linux distribution running on your instances.  Copy the appropriate file and prepend ‘gcm-’ in front on the copy’s name. (e.g. /etc/sysconfig/gcm-stackdriver or /etc/default/gcm-stackdriver-agent)  Change or add the following lines to your copy:

 

# whether or not to autogenerate the stackdriver collectd config file
AUTOGENERATE_COLLECTD_CONFIG="yes"

# write to the GCM API instead of the legacy SD path
DETECT_GCM="yes"

 

***Once you’ve completed migration this configuration file can become your primary file by moving it back to either the /etc/sysconfig/stackdriver or /etc/default/stackdriver-agent name respectively.

Stack-config script

Copy the /opt/stackdriver/stack-config file and name it “gcm-stack-config” to keep it separate from the legacy agent.  You’ll need to rename the filenames in this script in /etc/init.d, /etc/sysconfig and /etc/default.  The key filenames that need renaming are:

  • /etc/sysconfig/stackdriver → /etc/sysconfig/gcm-stackdriver

  • /etc/default/stackdriver-agent → /etc/default/gcm-stackdriver-agent

  • stackdriver-extractor → gcm-stackdriver-extractor

  • /etc/init.d/stackdriver-agent → /etc/init.d/gcm-stackdriver-agent

Stackdriver-agent init script

Copy the /etc/init.d/stackdriver-agent file and name it “gcm-stackdriver-agent” to keep it separate from the legacy agent as well.  You’ll need rename some strings in this file, but less than the config script.  The key strings that need renaming:

  • /opt/stackdriver/collectd/sbin/stackdriver-collectd → /opt/stackdriver/collectd/sbin/gcm-stackdriver-collectd

  • /etc/sysconfig/stackdriver → /etc/sysconfig/gcm-stackdriver

  • /etc/default/stackdriver-agent → /etc/default/gcm-stackdriver-agent

  • /opt/stackdriver/collectd/etc/collectd.conf → /opt/stackdriver/collectd/etc/gcm-collectd.conf

  • /var/run/stackdriver-agent.pid → /var/run/gcm-stackdriver-agent.pid

  • NAME=stackdriver-agent → NAME=gcm-stackdriver-agent

 

Start the new agent by running: /etc/init.d/gcm-stackdriver-agent start

 
https://cdn.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete