我们正在使用Google Cloud Platform作为我们的解决方案,我们有数百个vm在多个项目中运行,作为Stackdriver警报系统变更的一部分,Google已经要求通过运行:-
来升级所有vm的监控代理:sudo apt-get install stackdriver-agent
sudo /opt/stackdriver/stack-config --write-gcm
是我用来同时在所有VM上运行升级命令的任何脚本或实用程序,而不是ssh到每个VM并单独运行。
同样,当运行命令" sudo apt-get install stackdriver-agent
"时,请求a" API key for use with Stackdriver
" - " Stackdriver requires an API key to submit metrics. You can get an API key from https://app.stackdriver.com/settings/
"
是否有办法在脚本或实用程序中提供此键
当使用--write-gcm
时,不再需要API密钥,因此您可以在安装脚本中将其留空。您看到了一些遗留代码——很抱歉造成了混乱。
至于一次升级多个虚拟机,Google并没有提供现成的解决方案,但是你可以使用一个流行的配置管理工具(例如,Puppet, Chef, Salt, Ansible)来编写这样的升级脚本。Puppet、Chef和Ansible有一些(有些过时的)解决方案,您可以尝试根据您的用例进行调整。
还可以使用mussh对多个ssh主机并行执行命令。