How to get a VPS stats from SSH bash command line for SolusVM API

The client API is a http based API that allows you and your clients to interact directly with a virtual server with security and easiness. The client API can be disabled at any time. Access is only granted with a key and hash on a per vps basis. We will show you how you can get the solusvm info from SSH bash script . It will be helpful for all of you to use it in different script

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:

152.65.68.127516192768,325312512,7190880256,4268435456000,115806842,268319649158,0134217728,47583232,86634496,35successmaster.dnsmagic.org134.120.43.51

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”

Share This :

Leave a Reply

Your email address will not be published. Required fields are marked *