How to get a VPS’s stats from bash command line using SolusVM Client API

The basic command is of this form:

#curl --data "key=$KEY&hash=$HASH&action=info&ipaddr=true&mem=true&hdd=true&bw=true" $SERVERURL/api/client/command.php

This returns data of the form:

<ipaddr>134.120.43.52,2602:fff8:100:2::6ff4:6b5a</ipaddr><hdd>7516192768,325312512,7190880256,4</hdd><bw>268435456000,115806842,268319649158,0</bw><mem>134217728,47583232,86634496,35</mem><status>success</status><statusmsg></statusmsg><hostname>master.dnsmagic.org</hostname><ipaddress>134.120.43.51</ipaddress><vmstat></vmstat>

In script form:
First define variables:

KEY="LNAQP-ZEWDZ-3EKFR"
HASH="076dffc30f43cc3a134666a04afba78932212b3323e"
ACTION="info&ipaddr=true&mem=true&hdd=true&bw=true"
URL="https://manage.cloud.com"

Then execute it from bash:

curl --data "key=$KEY&hash=$HASH&action=$ACTION" "$URL/api/client/command.php"

Shutdown:

ACTION="shutdown"

View the Complete documentation here.


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.