Resize a VM when running out of memory
Using the Glesys API you can automatically resize a VM when it starts running low on memory.
Increase the memory using Bash
#!/bin/bash
TOTAL=`cat /proc/meminfo |grep "MemTotal" |awk {'print $2'}`
FREE=`cat /proc/meminfo |grep -E "MemFree|Cached"| awk '{s+=$2} END {print s}'`
USAGE=$((100-FREE*100/TOTAL));
if [ $USAGE -gt 90 ]; then
/usr/bin/curl -X POST -d serverid=wps123456&memorysize=4096 -k --basic -u cl12345:API-KEY https://api.glesys.com/server/edit/
fiIncrease the memory using Ruby
Running the Ruby script in a cron job
PreviousLet's Encrypt DNS-01 challenge using Glesys API and DehydratedNextLoad balancing and failover using the Glesys API
Last updated
Was this helpful?