remove and reinstall/update stackdriver-agent

3.3k views Asked by At

Is there another method of removing and reinstalling/updating stackdriver-agent after pinning it to a certain version beyond removing to reinstall the latest?

  • stackdriver-agent.x86_64 5.5.2-1001.el7
  • stackdriver-agent.x86_64 5.5.2-1002.el7

Running "install -y stackdriver-agent" still uses stackdriver-agent.x86_64 0:5.5.2-1002.el7 even after "remove stackdriver-agent".

Is there a config file to make this change before pulling/installing the latest version which is 6.*?

2

There are 2 answers

0
Wojtek_B On

Try going over the "Installing the Cloud Monitoring agent on a single VM" documentation which I've went through.

I was able to install, start, stop, remove and install another version of the agent.

Here's how I did it (using CentOS 6 box):

I've created a new CentOS 6 VM, added agent's repository to package list:

[wbogacz@centos ~]$ curl -sSO https://dl.google.com/cloudagents/add-monitoring-agent-repo.sh
[wbogacz@centos ~]$ sudo bash add-monitoring-agent-repo.sh
Adding agent repository for Red Hat.

Then listed all available versions for this OS:

[wbogacz@centos ~]$ sudo yum list --showduplicates stackdriver-agent
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: mirror.eu.oneandone.net
 * centos-sclo-rh: ftp.plusline.net
 * centos-sclo-sclo: mirror.infonline.de
 * epel: d2lzkl7pfhq30w.cloudfront.net
 * extras: ftp.plusline.net
 * updates: ftp.plusline.net
google-cloud-monitoring/signature                                                        |  454 B     00:00     
google-cloud-monitoring/signature                                                        | 1.4 kB     00:00 ... 
Installed Packages
stackdriver-agent.x86_64                         5.5.2-1002.el6                         @google-cloud-monitoring
Available Packages
stackdriver-agent.x86_64                         5.5.2-1001.el6                         google-cloud-monitoring 
stackdriver-agent.x86_64                         5.5.2-1002.el6                         google-cloud-monitoring 

Version 6 of the agent is not available for CentOS 6 (it shows in CentOS 8).

I then installed 1001 version:

Loading mirror speeds from cached hostfile
 * base: mirror.eu.oneandone.net
 * centos-sclo-rh: ftp.plusline.net
 * centos-sclo-sclo: mirror.infonline.de
 * epel: d2lzkl7pfhq30w.cloudfront.net
 * extras: ftp.plusline.net
 * updates: ftp.plusline.net
Resolving Dependencies
--> Running transaction check
---> Package stackdriver-agent.x86_64 0:5.5.2-1001.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================
 Package                     Arch             Version                   Repository                         Size
================================================================================================================
Installing:
 stackdriver-agent           x86_64           5.5.2-1001.el6            google-cloud-monitoring           1.3 M

Transaction Summary
================================================================================================================
Install       1 Package(s)

Total download size: 1.3 M
Installed size: 4.9 M
Downloading Packages:
85f2f9343af9e0c4669fb9214584c8d4c2ccacfd0a5559e7d980bc4ae85babc6-stackdriver-agent-5.5.2 | 1.3 MB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : stackdriver-agent-5.5.2-1001.el6.x86_64                                                      1/1 
  Verifying  : stackdriver-agent-5.5.2-1001.el6.x86_64                                                      1/1 

Installed:
  stackdriver-agent.x86_64 0:5.5.2-1001.el6                                                                     

Complete!

Listed installed agent's again and got nothing:

[wbogacz@centos ~]$  sudo yum list installed | grep stack
stackdriver-agent.x86_64

Started the agent:

[wbogacz@centos ~]$ sudo service stackdriver-agent start
Starting stackdriver-collectd: option = Interval; value = 60.000000;
option = Hostname; value = ;
option = FQDNLookup; value = false;
Created new plugin context.
option = PIDFile; value = /var/run/stackdriver-agent.pid;
option = Interval; value = 60.000000;
option = Hostname; value = ;
option = FQDNLookup; value = false;
Created new plugin context.

Remove the agent

[wbogacz@centos ~]$ sudo yum remove stackdriver-agent
Loaded plugins: fastestmirror, security
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package stackdriver-agent.x86_64 0:5.5.2-1001.el6 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================
 Package                     Arch             Version                  Repository                          Size
================================================================================================================
Removing:
 stackdriver-agent           x86_64           5.5.2-1001.el6           @google-cloud-monitoring           4.9 M

Transaction Summary
================================================================================================================
Remove        1 Package(s)

Installed size: 4.9 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing    : stackdriver-agent-5.5.2-1001.el6.x86_64                                                      1/1 
  Verifying  : stackdriver-agent-5.5.2-1001.el6.x86_64                                                      1/1 

Removed:
  stackdriver-agent.x86_64 0:5.5.2-1001.el6                                                                     

Complete!

Install 1002 version:

Loading mirror speeds from cached hostfile
 * base: mirror.eu.oneandone.net
 * centos-sclo-rh: ftp.plusline.net
 * centos-sclo-sclo: mirror.infonline.de
 * epel: d2lzkl7pfhq30w.cloudfront.net
 * extras: ftp.plusline.net
 * updates: ftp.plusline.net
Resolving Dependencies
--> Running transaction check
---> Package stackdriver-agent.x86_64 0:5.5.2-1002.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================
 Package                     Arch             Version                   Repository                         Size
================================================================================================================
Installing:
 stackdriver-agent           x86_64           5.5.2-1002.el6            google-cloud-monitoring           1.3 M

Transaction Summary
================================================================================================================
Install       1 Package(s)

Total download size: 1.3 M
Installed size: 4.9 M
Downloading Packages:
2a595a0373346006564e3ddc1a15101460b78d72936b11ba177ac956b125cca2-stackdriver-agent-5.5.2 | 1.3 MB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : stackdriver-agent-5.5.2-1002.el6.x86_64                                                      1/1 
  Verifying  : stackdriver-agent-5.5.2-1002.el6.x86_64                                                      1/1 

Installed:
  stackdriver-agent.x86_64 0:5.5.2-1002.el6                                                                     

Complete!

Check installed version:

[wbogacz@centos ~]$ rpm --query --queryformat '%{NAME} %{VERSION} %{RELEASE} %{ARCH}\n' \
>      stackdriver-agent
stackdriver-agent 5.5.2 1002.el6 x86_64
0
metacogni On

The ONLY way I was able to get the new version installed was to remove from all prod systems the logging agent first, then the agent, then reinstall.

stackdriver-agent.x86_64 0:6.0.5-1.el7