[英]How can I get list of instances where stackdriver monitoring agent is not installed in gcp?
I have 100's of instances I want to make sure that stackdriver monitoring agent is installed in all my gcp instances.我有 100 个实例,我想确保在我的所有 gcp 实例中都安装了 stackdriver 监控代理。 Is there any way I can get a list of instances which does not have stackdriver monitoring agent installed in a project or the other way around either by using python modules or gcloud?有什么方法可以通过使用 python 模块或 gcloud 来获取项目中没有安装 stackdriver 监控代理的实例列表?
You could query the agent version when you connect through SSH from the Cloud Shell您可以通过 SSH 从云端 Shell 连接时查询代理版本
gcloud compute ssh INSTANCE-NAME -- "dpkg-query --show --showformat \
'${Package} ${Version} ${Architecture} ${Status}\n' \
stackdriver-agent" --zone=INSTANCE-ZONE
Option -- of gcloud compute ssh allows you to send arguments to the SSH command, from there you can just list the agent version and if it is not installed it will not return a version选项-- gcloud compute ssh允许您将 arguments 发送到 SSH 命令,从那里您可以仅列出代理版本,如果未安装,则不会返回版本
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.