简体   繁体   English

如何获取未在 gcp 中安装 stackdriver 监控代理的实例列表?

[英]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.

相关问题 我可以使用任何堆栈驱动程序监控 api 或 gcloud 命令获得 gcp 计算建议以调整实例大小吗 - Can I get gcp compute recommendations to resize the instance using any stackdriver monitoring api or gcloud command 如何通过 python 脚本获取 gcp stackdriver 日志? - how can I get gcp stackdriver logs via python script? 如何使用python获取所有已安装程序的列表(文件,列表等)? - How can i get a list (file, list, whatever) of all installed programs using python? 如何在 GCP 中使用 Compute API 列出具有特定标签的实例? - How do list instances with specific label using Compute API in GCP? 使用Boto3,如何在EC2实例列表中获得小于Y的卷? - With Boto3, how can I get volumes that are smaller than Y in a list of EC2 Instances? GCP Stackdriver 自定义标签 - GCP Stackdriver custom tags 如何找到 Python 在 Windows 上的安装位置? - How can I find where Python is installed on Windows? 如何通过 python 中的时间戳过滤 GCP 堆栈驱动程序日志 - How to filter GCP stackdriver logs by timestamp from python 如何从GCP上的Stackdriver解析审核日志条目 - How to parse audit log entries from Stackdriver on GCP 如何获取在一个服务帐户下分配的多个 GCP 项目的列表? ( GCP )( python 客户端库文件) - How can get list of multiple - GCP projects assigned under one service account ? ( GCP )( python-client library files)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM