Reputation: 21
I have an alert in Stackdriver for when disk usage is above 90%. Is it possible to create a script that cleans a specific folder whenever this alert is raised?
Upvotes: 2
Views: 304
Reputation: 889
TL;DR: Not advisable to do so.
Is always a better idea to properly manage the data on your VM. You can use logrotate to get rid of old logs.
If you really really want execute a script when an alert is triggered, you can use a Webhook and tool like Hookdoo so when Stackdriver triggers an alert, it will call Hookdoo (installed) on your VM and can configure Hookdoo to delete some files on your VM.
Upvotes: 1