Reputation: 154
I have 100's of instances I want to make sure that stackdriver monitoring agent is installed in all my gcp instances. 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?
Upvotes: 0
Views: 359
Reputation: 806
You could query the agent version when you connect through SSH from the Cloud 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
Upvotes: 0