[英]Getting Dynamic Inventory for Sensu go from google cloud
I need suggestion to provide the host IP and port to sensu-go
at runtime.我需要建议在运行时提供主机 IP 和端口到
sensu-go
。 Currently, we are using static inventory for our VMs which are created in google cloud
which causes issues when those instances get deleted and new gets created.目前,我们正在为我们的虚拟机使用 static 库存,这些虚拟机是在
google cloud
中创建的,当这些实例被删除并创建新实例时会导致问题。 So, I'm looking for a solution to provide the dynamic inventory to sensu-go
.因此,我正在寻找一种解决方案来为
sensu-go
提供动态库存。 However, I could not find a way to query the google cloud in sensu-go and get the host IP(s) by providing tag and project name.但是,我找不到在 sensu-go 中查询谷歌云并通过提供标签和项目名称来获取主机 IP 的方法。
I'm looking for a suggestion to get the host IPs for a given tag from google cloud without using sensu-go
client in each host.我正在寻找一个建议,以从谷歌云获取给定标签的主机 IP,而无需在每个主机中使用
sensu-go
客户端。
Thanks very much in advance.首先十分感谢。
To get a list of IP's used by instances tagged with, say, 'sensu' you can use gcloud commands.要获取标记为“sensu”的实例使用的 IP 列表,您可以使用 gcloud 命令。
To get internal IP:要获取内部 IP:
gcloud compute instances list --project=PROJECT_NAME --filter="tags.items=(SENSU)" --format="get(networkInterfaces[0].networkIP)"
For external IP:对于外部 IP:
gcloud compute instances list --project=PROJECT_NAME --filter="tags.items=(SENSU)" --format="get(networkInterfaces[0].accessConfigs[0].natIP)"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.