Google Cloud Platform: VM Monitoring agent installation failing - google-cloud-platform

I tried installing the monitoring agent multiple times using both Google Cloud Console & Command Line. None of the approach worked.
My OS Version:
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
Installation Logs:
curl -sSO https://dl.google.com/cloudagents/add-monitoring-agent-repo.sh
sudo bash add-monitoring-agent-repo.sh --also-install
Error:
Err:10 https://packages.cloud.google.com/apt google-cloud-monitoring-bullseye-all Release
404 Not Found [IP: 142.250.182.206 443]

It fails because it's getting 404 from the legacy monitoring agent source list and you need the updated Cloud Ops Agent script:
curl -sSO https://dl.google.com/cloudagents/add-google-cloud-ops-agent-repo.sh
You would also need to remove the apt source of google-cloud-monitoring:
sudo rm /etc/apt/sources.list.d/google-cloud-monitoring.list
Then run the script installation inside the VM Instance:
sudo bash add-google-cloud-ops-agent-repo.sh --also-install
As the Legacy Monitoring Agent does not support the Debian 11 Bullseye.

Related

anthoscli ERROR on installing Google Cloud SDK on Apple Silicon / Big Sur

I am searching for the solution for some weeks now. A couple weeks ago I received the new MacBook Pro with the Apple Silicon processor and with Big Sur installed on it. When I tried to install Google Cloud SDK, because I need that for my work, I get my first problem. I opened the terminal and used "curl https://sdk.cloud.google.com | bash" to start the installation.
After I received the question if I want to help to improve Google Cloud SDK and hit 'N' this error follows. Also when I hit 'Y'...
ERROR: (gcloud.components.update) The following components are unknown [anthoscli].
On the internet I can't found something about this error. The only thing what I have found on anthoscli is that I think it has something to do with Kubernetes and/or Docker. So I tried to install Docker first, only they are not ready for Apple Silicon yet...
I can't imagine being the only one with this problem so I hope someone here can help me further.
It's a known issue "Apple Silicon Installer does not exist"
The workaround from the above link is:
Attempt install: curl https://sdk.cloud.google.com | bash
Run installer manually using files from above failed install ./google-cloud-sdk/bin/gcloud components install core gsutil
Re-run init: ./google-cloud-sdk/bin/gcloud init
I got gcloud to install by installing under Rosetta 2.
curl https://sdk.cloud.google.com > install.sh
chmod +x install.sh
arch -x86_64 install.sh --disable-prompts
# restart shell
gcloud help
I don't think Apple did a good job of advertising this feature, because I only found it in a random Hacker News thread. I've used this strategy quite a bit and added this to my shell's rc file.
x86() {
arch -x86_64 $1
}
x86 install.sh --disable-prompts
I just tested on Apple M1 MBP Big Sur 11.1, which works for me.
Followed mager.co blogpost-How to install gcloud on an M1 Mac
Full steps as following:
Install homebrew package management first
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install Python 3.9.1 use pyenv
brew install pyenv
pyenv install 3.9.1
pyenv global 3.9.1
Set an env variable letting the gcloud installer know which version of Python to use:
export CLOUDSDK_PYTHON=python3
Download the SDK and start the install, which I ran into ERROR the following components are unknown [anthoscli, kuberun]:
curl https://sdk.cloud.google.com | bash
Thus manually run the install.sh script
cd ~/google-cloud-sdk
./install.sh --override-components core gcloud-deps bq gcloud gsutil
The easiest way to install Google Cloud SDK is with homebrew, but Homebrew doesn't have an arm64 variant for M1 yet. Nonetheless, I've outlined steps to install and use it on M1 Macs: https://stackoverflow.com/a/66299285/2006016
1. Installing gcloud SDK
After installing your Homebrew on your M1 Mac, in your Rosetta Terminal, run the following command:
brew install --cask google-cloud-sdk
2. Linking gcloud to $PATH
Once Homebrew has it installed, you'll need to add it to your path. In the last few lines it will show you the path to set your source:
From the screenshot above, I'll have to run the following to set the command in my $PATH:
source /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc
source /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc
3. Using gcloud
Once linked, you can use the gcloud command in your terminal:
gcloud -v
4. Outdated Python
In case your python is outdated (see Google Cloud SDK Requirements), you can use Homebrew to update it by running:
brew upgrade
You can view your python version when listing out your Homebrew packages:
brew outdated
This happens when you have MAC M1 chip so you might need to install manually for this i choose to go with Google given method
muhasan#Admins-MacBook-Pro ~ % curl https://sdk.cloud.google.com | bash
Output :
For the latest full release notes, please visit:
https://cloud.google.com/sdk/release_notes
╔════════════════════════════════════════════════════════════╗
╠═ Creating update staging area ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: BigQuery Command Line Tool ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: BigQuery Command Line Tool (Platform Spec... ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Cloud Storage Command Line Tool ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Cloud Storage Command Line Tool (Platform... ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Default set of gcloud commands ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Google Cloud CLI Core Libraries (Platform... ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: anthoscli ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: anthoscli ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: gcloud cli dependencies ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Creating backup and activating new installation ═╣
╚════════════════════════════════════════════════════════════╝
Performing post processing steps...done.
Update done!
Please follow the steps mentioned in the following Google Cloud SDK Installation Documentation to install Google Cloud SDK on MacOS:
Cloud SDK requires Python. Follow the next documentation on how to choose and configure your Python interpreter
Download the MacOS package from the Google Cloud SDK Documentation.
2.1) Extract the archive to any location on your file system. On macOS, this can be achieved by opening the downloaded .tar.gz archive file in the preferred location.
2.2) Optional. Use the install script to add Cloud SDK tools to your path -->
./google-cloud-sdk/install.sh
2.3) Close and Open a new terminal so that the changes take effect.
2.4) Run gcloud init to initialize the SDK:
./google-cloud-sdk/bin/gcloud init
As I can see that you have use the Google Cloud SDK Installer to install Google Cloud SDK on MacOS. Please try again the following steps to install Google Cloud SDK using the installer:
Enter the following at a command prompt:
curl https://sdk.cloud.google.com | bash
Restart your shell:
exec -l $SHELL
Run gcloud init to initialize the gcloud environment:
gcloud init
In case you want to install Google Cloud SDK through the interactive installer, and you are getting the error mentioned above, You can create an issue on Google's Public Issue Tracker for further investigation. However also please try to install the Google Cloud SDK without the installer as I mentioned before.

gcloud app deploy crashes with "Unable to assign value to attribute 'timezone'" on Cloud SDK version 297.0.0

Using gcloud app deploy to deploy to App Engine will fail if cron.yaml or cron.xml contains timezone information, when run using Cloud SDK 297.0.0.
For example:
[INFO] GCLOUD: ERROR: (gcloud.app.deploy) An error occurred while parsing file: [/path/to/file/cron.yaml]
[INFO] GCLOUD: Unable to assign value 'America/New_York' to attribute 'timezone':
[INFO] GCLOUD: timezone 'America/New_York' is unknown
The workaround is to downgrade to version 296.0.1 of the Cloud SDK. (Substitute 296.0.1 for VERSION below.)
If you installed the SDK directly (outside of a package manager), you should use gcloud components to update: gcloud components update --version VERSION. This includes all installation mechanisms on this page (including the interactive installer, static versions, Windows installer, and Homebrew) but excludes the two following bullets.
If you installed via the rapture repo for Debian/Ubuntu: sudo apt-get update && sudo apt-get install google-cloud-sdk=VERSION-0
If you installed via the rapture repo for RedHat/CentOS: sudo yum downgrade google-cloud-sdk-VERSION
If for any reason any of the above do not work, use the download archive to manually download an older version, and install using http://cloud/sdk/docs/downloads-versioned-archives.
I got the same problem and I wrote a ticket to the GCP support.
It seems that they are not well aware of the bug.

Deploying Rails 6.0 to AWS EB, Webpacker requires Node.js version error

I am attempting to upload a rails app that was recently updated from rails 5.2 to 6 to AWS Elastic Beanstalk. We had someone else working on this, but with the pandemic he had to step away - and now our site is kind of in limbo and I have not been able to update it. I have searched many different variations of my problem but no solutions have worked yet.
The app was working on EB with rails 5.2. I have the app running in 6.0 locally. When I eb deploy I get this error:
MacBook-Pro:app $ eb deploy
Starting environment deployment via CodeCommit
--- Waiting for Application Versions to be pre-processed ---
Finished processing application version app-0e294-200420_110159
2020-04-21 00:22:24 INFO Environment update is starting.
2020-04-21 00:23:07 INFO Deploying new version to instance(s).
2020-04-21 00:27:59 ERROR [Instance: i-0e613ac1fe175f3f6] Command failed on instance. Return code: 1 Output: (TRUNCATED)...-- : Writing /var/app/ondeck/public/assets/application-06fe3df6175ba0def3d0e732489f883d0c09de.css.gz
Webpacker requires Node.js ">=10.13.0" and you are using v6.17.1
Please upgrade Node.js https://nodejs.org/en/download/
Exiting!.
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/11_asset_compilation.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
2020-04-21 00:27:59 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2020-04-21 00:28:00 ERROR Unsuccessful command execution on instance id(s) 'i-0e613ac1fe175f3f6'. Aborting the operation.
2020-04-21 00:28:00 ERROR Failed to deploy application.
ERROR: ServiceError - Failed to deploy application.
It was giving me a bundler error before this, that I was able to fix by adding a file into .ebextensions that installs the correct version of bundler. I figured the solution to this would be similar.
This post was close to my problem:
Deploy rails react app with webpacker gem on AWS elastic beanstalk
So I added this file to my .ebextensions based off the selected answer of that:
01_update_note.config
commands:
01_download_nodejs:
command: curl --silent --location https://rpm.nodesource.com/setup_10.x | sudo bash -
02_install_nodejs:
command: yum -y install nodejs
However, it did not appear to do anything, I still get the same error. I tried a couple variations of the file based off a few other blog posts about the issue, but the error remains. Is anyone able to point me in the right direction or offer any insight into the problem? I apologize for not being very familiar with AWS or EB yet, but I will do my best to answer additional questions.
Maybe it is caused by yarn install later.
I try the following scripts and remove yarn install then set RAILS_SKIP_ASSET_COMPILATION=false and it works for me.
commands:
01_install_yarn:
command: "sudo wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo && curl --silent --location https://rpm.nodesource.com/setup_12.x | sudo bash - && sudo yum install yarn -y"
02_download_nodejs:
command: curl --silent --location https://rpm.nodesource.com/setup_12.x | sudo bash -
03_install_nodejs:
command: yum -y install nodejs
04_install_packages:
command: sudo yum install -y yarn
This is how I did it on Amazon Linux 2:
Create this file in .platform/hooks/prebuild/yarn_config.sh:
#!/usr/bin/env bash
curl --silent --location https://rpm.nodesource.com/setup_16.x | sudo bash -
sudo yum -y install nodejs
sudo wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo
sudo yum -y install yarn
yarn install
Give it the right permission: chmod +x .platform/hooks/prebuild/yarn_config.sh
And the error is gone, while you assets still compile (unlike with accepted answer)

start cassandra on google cloud on debian vm

I have created a Debian VM and followed the steps to install cassandra on it. In the end, when I ran sudo apt update
sudo apt install cassandra
cassandra was installed and also automatically started.
However, cassandra wasn't added to PATH. I stopped cassandra using ps -aux|grep cassandra and kill pid. Now when I am trying to start it again using cassandra -f, I am getting several permission denied errors. eg
/usr/sbin/cassandra -f
OpenJDK 64-Bit Server VM warning: Cannot open file /var/log/cassandra/gc.log due to Permission denied
I can try using -R option and start Cassandra as root but it is not recommended. How can I start cassandra as normal user?

docker info command doesn't show anything in ec2 Instance

I have installed docker using sudo yum install -y docker and started the docker service by running the following commands. Initially, it worked and I was able to run docker containers. Now the docker daemon is working but wen I run docker commands like docker ps, docker info..etc. It's not showing anything on stdout.
I have uninstalled the docker version using sudo yum remove docker and removed all the files manually and installed the new one but still it's the same issue.
Here is the link that I have followed to install docker in EC2 instance.
https://aws.amazon.com/blogs/devops/set-up-a-build-pipeline-with-jenkins-and-amazon-ecs/
Docker version
1.12.6, build 7392c3b/1.12.6
uname -a
Linux ip adress 4.4.41-36.55.amzn1.x86_64 #1 SMP Wed Jan 18 01:03:26 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
I was not able to figure out what went wrong? Could you please help me in debug this issue.
Thank you in advance.
As I understood from what you said and going through the link you mentioned, you have given the docker command capabilities to the user jenkins, which you have done using :
usermod -a -G docker jenkins
So in order to run docker related command you should login as the user Jenkins. You can use the following command to login as the user jenkins.
sudo -su jenkins
From there you should be able to run the docker commands as expected.
PS - Follow the steps again to install docker.
Hope this help.