softnas-cmd ver. 0.0.2 The "softnas-cmd" command line interface utility facilitates integration with the REST API as a CLI (command line interface). softnas-cmd is written in CURL and is cross-platform code. It may also be useful as example code for how to use the API, for those who wish to explore it in more detail as a working example. The softnas-cmd CLI is designed to be used from the command line. When running within the Amazon Web Services (AWS) environment, softnas-cli is a convenient tool for use with Cloud Formation templates, which can be combined to automate configuration and setup of SoftNAS storage systems. As with all SoftNAS API applications, softnas-cmd requires that you first authenticate with the SoftNAS server using the "login" command. Once you are logged in, softnas-cmd maintains a simulated cookie jar that emulates how a browser interacts with a web server to maintain session security (required by the SoftNAS server). Subsequent commands issued via the softnas-cmd CLI make use of the login session (which expires after 30 minutes). Usage: softnas-cmd [-h | --help] | [[-b | --base_url URL] [-s | --session_id SESSION_ID] [-i | --insecure] | [-t | --pretty_print] COMMAND [OPTIONS]] OPTIONS : -h [command name], --help [command name] Display this help message and exit. You can specify command name to get the help of only one softnas command -b, --base_url URL Set base url for softnas application. By default URL=https://localhost/softnas -s, --session_id SESSION_ID Set the current session id to be used to used store session information. By default SESSION_ID=PPID -i, --insecure Disable ssl verfication -t, --pretty_print Display json result with indentation COMMAND : login Login into softnas application COMMAND OPTIONS : username password EXAMPLE : softnas-cmd login softnas Pass4W0rd logout Logout from softnas application EXAMPLE : softnas-cmd logout resetsessiontimer This command is used to keep session active. By default session timeout is set to 30 minutes. if you want to keep session from being expired just call this function. EXAMPLE : softnas-cmd resetsessiontimer licenseinfo Returns the current license information EXAMPLE : softnas-cmd licenseinfo licenseactivate Activate a license key for use with SoftNAS COMMAND OPTIONS : licencekey : the licence key; i.e., "softnas" register name : the registered name of the license key hardware id : can be obtained from "licenseinfo" in amazon the hardware id is the instance id EXAMPLE : softnas-cmd licenseactivate CEAASA-BESNJA-8MEED6-AHAZZN-XHWB8X-A2NUK3 RBLLC i-0b06fe44 internallicense Force SoftNAS to use its built-in, default license EXAMPLE : softnas-cmd internallicense ackagreement acknowledge the license agreement (to enable use of the product) EXAMPLE : softnas-cmd ackagreement checkupdate check to see if new software updates are available EXAMPLE : softnas-cmd internallicense executeupdate execute and apply software updates EXAMPLE : softnas-cmd executeupdate statusupdate return status of update that is in-progress (started by executeupdate) EXAMPLE : softnas-cmd statusupdate availabledisks returns list of available disk devices EXAMPLE : softnas-cmd availabledisks pools lists available storage pools COMMAND OPTIONS : start : position to start from (used for pagination) limit : number of items to get EXAMPLE : softnas-cmd pools 1 10 pooldetails list a storage pool's detailed attributes COMMAND OPTIONS : pool name : the pool name EXAMPLE : softnas-cmd pooldetails pool1 poolcommand issue a command to control a storage pool EXAMPLE : softnas-cmd poolcommand deletepool delete pool storage COMMAND OPTIONS : pool name : the pool name EXAMPLE : softnas-cmd deletepool pool1 volumes list available storage volumes COMMAND OPTIONS : start : position to start from (used for pagination) limit : number of items to get EXAMPLE : softnas-cmd volumes 1 10 createvolume create volume COMMAND OPTIONS : volume name : name of volume pool name : selected pool name volume type : possible values : - filesystem : Filesystem (NFS, CIFS) - blockdevice : Block Device (iSCSI LUN) provisioning : allocation space type. Possible values : - thin : Thin Provision - dynamically allocate space as it is needed - thick : Thick Provision - preallocate space from storage pool now reserve space : volume size (number) reserve units : size unit i.e G (Giga) compression : enable commpression dedup : enable commpression shareISCS : enable share ISCSI shareCIFS : enable share CIFS exportNFS : enable export NFS enable_snapshots: Enable scheduled volume snapshots schedule_name : Snapshot schedule name hourlysnaps : hourly maximum number of scheduled snapshot dailysnaps : daily maximum number of scheduled snapshot weeklysnaps : weekly maximum number of scheduled snapshot EXAMPLE : softnas-cmd createvolume volume5 pool3 filesystem thin exportNFS=on shareCIFS=on dedup=on enable_snapshot=on schedule_name=Default hourlysnaps=5 dailysnaps=10 weeklysnaps=0 editvolume edit volume EXAMPLE : softnas-cmd availabledisks deletevolume delete volume COMMAND OPTIONS : volume name : name of volume pool name : pool name EXAMPLE : softnas-cmd deletevolume volume6 pool3 schedulelist list available schedules EXAMPLE : softnas-cmd schedulelist snapshotlist list available snapshots COMMAND OPTIONS : pool name : pool name i.e "pool3/vol1" start : position to start from (used for pagination) limit : number of items to get EXAMPLE : softnas-cmd snapshotlist pool3/vol1 0 10 iscsitargetlist list of available iSCSI targets COMMAND OPTIONS : start : position to start from (used for pagination) limit : number of items to get returnGlobals EXAMPLE : softnas-cmd iscsitargetlist 0 10 returnGlobals diskdevices list of available disk devices and their status EXAMPLE : softnas-cmd diskdevices diskmgmt issue a disk management command COMMAND OPTIONS : command : possible values - createS3disk : create s3 disk. Related options: - awsAccessKey : s3 aws access key id - awsSecretKey : s3 aws secret key - s3bucket : s3 bucket name must be unique - bucketroot : s3 bucket root - sizeMaxValue : Disk size - sizeMaxUnits : Size unit TB or GB - diskpassword : disk password protection - cb_encrypted : add it to encrypt disk - cb_readahead : - deleteS3disk : delete s3 disk - s3diskname : s3 disk name i.e (/dev/s3-0) - getS3settings : get list of s3 setting stored in config file - bucketlist : get list of aws s3 buckets EXAMPLE 1 : create s3 disk softnas-cmd diskmgmt createS3disk awsAccessKey=YOUR_AWS_ACCESS_KEY_ID awsSecretKey=YOUR_AWS_SECRET_KEY s3bucket=softnas-test-1 bucketroot=softnas sizeMaxValue=500 sizeMaxUnits=GB diskpassword=password123* EXAMPLE 2 : get list of buckets softnas-cmd diskmgmt bucketlist EXAMPLE 3 : get list of s3 setting stored in config file softnas-cmd diskmgmt getS3settings EXAMPLE 4 : delete s3 disk softnas-cmd diskmgmt deleteS3disk "/dev/s3-0" parted_command issue a disk partitioning command COMMAND OPTIONS : command : possible values - partition_all : partion all disk not partioned - add_partition - remove_partition - disk name : selected disk device name EXAMPLE : softnas-cmd parted_command add_partition dev/xvdr snaprepcommand issue SnapReplicate command COMMAND OPTIONS : command : possible values - snapverify : verify the remote node. Related options: - remotenode : ip adress of remote node - userid : username for remote node - password : password of remote node - initsnapreplicate : begin initial replicate with remote node - type : type of remote node possible values source or target - remotenode : ip adress of remote node - userid : username for remote node - password : password of remote node - keyexchange : Exchange servers keys and allow remote servers ssh connection for each node - keyfile : public key file path (/var/www/softnas/keys/SoftNAS-PrimaryPublic.pem) - pubEncoded : Keyfile content base64 encoded - serverEncoded : rsa public host key content file base 64 encoded (/etc/ssh/ssh_host_rsa_key.pub) - serverIP : server node ip (sender) - snapreplicatestatus : get the current status of replication - start : position to start from (used for pagination) - limit : number of items to get - snapreplog : get snapreplicate log - start : position to start from (used for pagination) - limit : number of items to get - snapreplicatetasks : get snapreplicate tasks - start : position to start from (used for pagination) - limit : number of items to get - forcesync : force synchronization between nodes - replicatenow : get snapreplicate log - activate : activate replication - deactivate : deactivate replication - takeover : takeover as replication source - giveback : giveback replication source duties - deletereplication : remove the replication - getsettings : get replication settings - modifysettings : edit replication settings - loglevel : Logging Level. Possible values -- info : Informational, warning and error messages (default) -- debug : Debug, informational, warning and error messages (all messages) -- warn : Warning and error messages -- error : Error messages only -- fatal : Fatal messages only -- off : No messages (not recommended) - transportcmd : Transport Command - transportflags : Transport Flags - cipherspec : Cipher Spec - compressenabled : Compress data stream (consumes additional CPU) - throttleenabled : enable bandwidth Throttle (per stream) - throttlelimit : limit size - throttleunits : size unit possible values -- b => bits/sec -- k => Kbits/sec -- m => Mbits/sec -- B => Bytes/sec -- K => Kbytes/sec -- M => MBytes/sec EXAMPLE 1 : snapreplicate verify remote node softnas-cmd snaprepcommand snapverify remotenode=10.227.57.227 userid=softnas password=Pass4W0rd -t EXAMPLE 2 : initiate snapreplicate softnas-cmd snaprepcommand initsnapreplicate remotenode=10.227.57.227 userid=softnas password=Pass4W0rd type=target -t EXAMPLE 3 : get snapreplicate status softnas-cmd snaprepcommand snapreplicatestatus start=0 limit=10 -t EXAMPLE 4 : get snapreplicate log softnas-cmd snaprepcommand snapreplog start=0 limit=10 -t EXAMPLE 5 : delete snapreplication softnas-cmd snaprepcommand deletereplication -t EXAMPLE 6 : get replication settings softnas-cmd snaprepcommand getsettings -t EXAMPLE 7 : force synchronization between 2 nodes softnas-cmd snaprepcommand forcesync -t EXAMPLE 8 : start replication cycle softnas-cmd snaprepcommand replicatenow -t EXAMPLE 9 : activate replication softnas-cmd snaprepcommand activate -t EXAMPLE 10 : deactivate replication softnas-cmd snaprepcommand deactivate -t EXAMPLE 11 : change role to primary node softnas-cmd snaprepcommand takeover -t EXAMPLE 12 : change role to secondery node softnas-cmd snaprepcommand giveback -t EXAMPLE 13 : modify replication settings softnas-cmd snaprepcommand modifysettings loglevel=info transportcmd=ssh transportflags="-o ConnectTimeout=30" cipherspec="aes128-cbc,blowfish-cbc,3des-cbc,cast128-cbc,aes192-cbc,aes256-cbc" compressenabled=on throttleenabled=on throttlelimit=200 throttleunits=K throttleflags= -t hacommand issue ha command COMMAND OPTIONS : command : possible values - checklicense : check for valid ha license - haLicenseKey : Ha license key (required) - regname : license registration name (optional). If not specified it will use softnas.ini registration name. - checkHAcontroller : Check for valid HA Controller IP address - haControllerIP : Controller IP address - install : Begin install HA from the SnapReplicate "source" node - haLicenseKey : Ha license key (required) - regname : license registration name (optional). If not specified it will use softnas.ini registration name. - add : Begin Add configuration of SNAP HA from the SnapReplicate "source" node - awsAccessKey : aws Access Key - awsSecretKey : aws Secret Key - vip : virtual IP (AWS Elastic IP) - haControllerIP : Controller IP address (required only on Virtual machine) - del : delete HA from SnapReplicate EXAMPLE 1 : check HA license softnas-cmd hacommand checklicense XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX --pretty_print EXAMPLE 2 : install HA softnas-cmd hacommand install XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX --pretty_print EXAMPLE 3 : Add HA softnas-cmd hacommand add YOUR_AWS_ACCESS_KEY YOUR_AWS_SECRET_KEY 54.84.87.120 --pretty_print EXAMPLE 4 : check HA controller softnas-cmd hacommand checkHAcontroller 50.15.14.15 --pretty_print EXAMPLE 5 : delete HA softnas-cmd hacommand del --pretty_print perfmon get performance monitoring status information IMPORTANT : This command gives 30 records. You should call this command in serie between each call less than 10 sec to get performance monitoring status information. For the first call this command will return all values as false and each next call with new record values. EXAMPLE : softnas-cmd perfmon overview get NAS overview status information EXAMPLE : softnas-cmd overview netstats get network performance status information EXAMPLE : softnas-cmd netstats diskstats get disk performance status information EXAMPLE : softnas-cmd diskstats createpool creates new storage pool COMMAND OPTIONS : disk devices : list of diskdevices separated by comma ":" pool name : the pool name raid level : possible values 0 : No RAID, JBOD 1 : RAID 1/10 (mirror, striped mirrors) 5 : RAID-Z (single parity) 6 : RAID-Z2 (dual parity) 7 : RAID-Z3 (triple parity) enable compression : possible values on, off EXAMPLE : softnas-cmd createpool /dev/xvdf:/dev/xvdg pool1 1 on -t readcache create cache disk devices for pool storage COMMAND OPTIONS : disk devices : list of diskdevices separated by comma ":" pool name : the pool name force cache : possible values on, off EXAMPLE : softnas-cmd readcache /dev/xvdr pool3 on writelog create log disk devices for pool storage COMMAND OPTIONS : disk devices : list of diskdevices separated by comma ":" pool name : the pool name raid level : possible values 0, 1 0 : No RAID, JBOD 1 : RAID 1/10 (mirror, striped mirrors) force cache : possible values on, off EXAMPLE : softnas-cmd writelog /dev/xvdk pool3 0 on addspare add spare disk to storage pool COMMAND OPTIONS : disk devices : list of diskdevices separated by comma ":" pool name : the pool name forced spare : possible values on, off EXAMPLE : softnas-cmd addspare /dev/xvdn pool3 on importpool import deleted or foreign pools COMMAND OPTIONS : pool name : the pool name pool type : possible values deleted, foreign force : possible values on, off EXAMPLE : softnas-cmd importpool pool1 deleted on help Display help text COMMAND OPTIONS : command name : Optional. You can add softnas command name to get the only help of it EXAMPLE : softnas-cmd help snaprepcommand