Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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. This document has been produced by running `softnas-cmd --help`.

...

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 json result with indentation.


Commands:

Table of Contents
maxLevel2
minLevel2

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"

...

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 the status of an 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.

COMMAND OPTIONS:

command name: zpool command name (startscrub, stopscrub, setonline, setoffline, removedevice, replacedevice)

pool name: the pool name

EXAMPLE:

softnas-cmd poolcommand <command> [arguments]

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 a volume.     

COMMAND OPTIONS:

vol_name: name of volume

pool: selected pool name

...

- disabled: this disables synchronous requests. File system  transactions are only committed to stable storage periodically. This option will give the highest performance.  However, it is very dangerous as ZFS would be ignoring the synchronous transaction demands of applications such as databases or NFS.  Administrators should only use this option when the risks are understood.

EXAMPLE:

softnas-cmd createvolume vol_name=volume5 pool=pool3 vol_type=filesystem provisioning=thin exportNFS=on shareCIFS=on dedup=on enable_snapshot=on schedule_name=Default hourlysnaps=5 dailysnaps=10 weeklysnaps=0 sync=always

editvolume

Edit a volume.

EXAMPLE:

softnas-cmd availabledisks

deletevolume

Delete a 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'

...

limit: number of items to get

EXAMPLE:

softnas-cmd snapshotlist pool3/vol1 0 10

snapcommand

Issue a volume snapshot control command.

COMMAND OPTIONS:

command: possible values

- create: create new snapshot. Related options:

...

- snapshots: list of snapshot to be deleted in this format "poolname,volumename,snapshotname:poolname1,volumename1,snapshotname1". see example

       

EXAMPLE 1 :

Create snapshot.

softnas-cmd snapcommand create pool_name=pool1 volume_name=vol1

EXAMPLE 2 :

Clone snapshot.

softnas-cmd snapcommand clone pool_name=pool1 volume_name=vol1 snap_name=snaphot1

EXAMPLE 3 :

Delete snapshots.

softnas-cmd snapcommand delete 'snapshots=pool1,volume1,snap-20150605-140647-cloned-Jun52015-141106:pool1,volume1,snap-20150606-070607'


iscsitargetlist

Provides a list of available iSCSI targets.

COMMAND OPTIONS:

start: position to start from (used for pagination)

limit: number of items to get


EXAMPLE:

softnas-cmd iscsitargetlist  0 10


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:

...

- encrypted: password for encrypting the disk


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 region=default encrypted diskpassword=password123* readahead blockCacheDevice=/dev/xvdf  

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"


EXAMPLE 5:

Create EBS Disk General Purpose (SSD).

softnas-cmd diskmgmt createEBSdisk AWSAccessKey=XXXXXXXXXXXXXXXXXX AWSSecretKey='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' sizeMaxValue=10 type=gp2 numberDisks=2 deleteOnTermination prewarming -t


EXAMPLE 6:

Create EBS Disk Provisioned IOPS (SSD).
softnas-cmd diskmgmt createEBSdisk AWSAccessKey=XXXXXXXXXXXXXXXXXX AWSSecretKey='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' sizeMaxValue=100 type=io1 iops=3000 numberDisks=2 deleteOnTermination prewarming -t


EXAMPLE 7 :

Create Azure Disk.

softnas-cmd diskmgmt createAzureDisk username=softnas password=Pass4W0rd storageAccount=SoftnasStorage sizeMaxValue=100 sizeMaxUnits=GB -t

parted_command

Issue a disk partitioning command.

COMMAND OPTIONS:

command: possible values

- partition_all: partition all disks that are not partitioned

...

- 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:

...

-- K => Kbytes/sec

-- M => MBytes/sec

       

EXAMPLE 1:

Verify the SnapReplicate 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 full synchronization of all volumes images between 2 nodes

softnas-cmd snaprepcommand forcesync -t

EXAMPLE 8:

Force full synchronization volume image between 2 nodes. You can specify a volume (poolname/volumename) to force full synchronization.

softnas-cmd snaprepcommand forcesync poolname/volumename -t

EXAMPLE 9:

Start replication cycle.

softnas-cmd snaprepcommand replicatenow -t

EXAMPLE 10:

Activate replication.

softnas-cmd snaprepcommand activate -t

EXAMPLE 11:

Deactivate replication

softnas-cmd snaprepcommand deactivate -t

EXAMPLE 12:

Change role to primary node.

softnas-cmd snaprepcommand takeover -t

EXAMPLE 13:

Change role to secondary node.

softnas-cmd snaprepcommand giveback -t

EXAMPLE 14:

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

...

- azure_delete: Delete Azure 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 EIP 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

EXAMPLE 6:

Azure install HA.

softnas-cmd hacommand azure_install azureUsername azurePassword 192.168.1.1 --pretty_print

EXAMPLE 7:

Azure delete HA.

            softnas-cmd hacommand azure_delele --pretty_print


perfmon

Get performance monitoring status information.

IMPORTANT: This command gives 30 records. You should call this command in series 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 Get NAS overview status information.       

EXAMPLE:

softnas-cmd overview

 

...


netstats

        get Get network performance status information.       

EXAMPLE:

softnas-cmd netstats

...

...


diskstats

        get Get disk performance status information.       

EXAMPLE:

softnas-cmd diskstats

 

...


createpool

        creates Creates new storage pool.       

COMMAND OPTIONS:

            disk devices        devices: list of diskdevices separated by comma ":"

            pool name           name: the pool name

            raid level          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  compression: possible values on, off       

EXAMPLE:

softnas-cmd createpool /dev/xvdf:/dev/xvdg pool1 1 on -t

 

...


readcache

        create Create cache disk devices for pool storage.       

COMMAND OPTIONS:

            disk devices    devices: list of diskdevices separated by comma ":"

            pool name       name: the pool name

            force cache     cache: possible values on, off
       

EXAMPLE:

softnas-cmd readcache /dev/xvdr pool3 on

 

...


writelog

        create Create log disk devices for pool storage.
       

COMMAND OPTIONS:

            disk devices    devices: list of diskdevices separated by comma ":"

            pool name       name: the pool name

            raid level      level: possible values 0, 1                0

0 : No RAID, JBOD

...

1 : RAID 1/10 (mirror, striped mirrors)

            force cache     cache: possible values on, off       

EXAMPLE:

softnas-cmd writelog /dev/xvdk pool3 0 on

...

...


addspare

        add Add spare disk to storage pool.        COMMAND

COMMAND OPTIONS:

            disk devices    devices: list of diskdevices separated by comma ":"

            pool name       name: the pool name

            forced spare    spare: possible values on, off       

EXAMPLE:

softnas-cmd addspare /dev/xvdn pool3 on

 

    importpool

...


importpool

Import deleted or foreign pools.       

COMMAND OPTIONS:

            pool name       name: the pool name

            pool type       type: possible values deleted, foreign

            force           force: possible values on, off       

EXAMPLE:

softnas-cmd importpool pool1 deleted on
 

...

backup

        issue Issue a EBS snapshots backup command.       

COMMAND OPTIONS:

            command: possible values

                - list      list: list ebs backup snapshots. Related options:                   

-

...

start: position to start from (used for pagination) (optional)

...

-

...

limit: number of items to get (optional)

                - create    create: create new ebs backup snapshot. Related options:                   

- access_

...

key: AWS S3 access key id (required)

...

- secret_

...

key: AWS S3 secret key (required)

                - restore   restore: restore ebs snapshot. Related options:                   

-

...

SnapshotID: Snapshot ID to restore (required)

...

- access_

...

key: AWS S3 access key id (required)

...

- secret_

...

key: AWS S3 secret key (required)

                - delete    delete: clone snapshot. Related options:                   

-

...

SnapshotID: Snapshot ID to delete (required)

...

EXAMPLE 1:

...

List ebs backup snapshots.           

softnas-cmd backup list 0 10 --pretty_print

...

EXAMPLE 2:

...

Clone snapshot.           

softnas-cmd backup create 'yourAWSAccessKey' 'yourAWSSecretKey' --pretty_print

...

EXAMPLE 3:

...

Restore ebs snapshot.           

softnas-cmd backup restore 'SnapshotID' 'yourAWSAccessKey' 'yourAWSSecretKey' --pretty_print

...

EXAMPLE 4:

...

Delete ebs snapshot.       

softnas-cmd backup delete 'SnapshotID' --pretty_print

...

...


tier_devices

        list List tiered storage devices.       

EXAMPLE:

softnas-cmd tier_devices

   

...

tier_enable

        mark Mark tiered storage device as enabled (but do not import it).       

COMMAND OPTIONS:

            name            name: human-readable tier name (ex. tierA)

            device          device: device node (ex. sdtiera)

            uuid            uuid: tier uuid       

EXAMPLE:

softnas-cmd tier_enable name=tierA

...

EXAMPLE:

softnas-cmd tier_enable device=sdtiera

...

EXAMPLE:

softnas-cmd tier_enable uuid=5B074FFFFF23FFFF56FFFFFF

...


tier_disable

        mark Mark tiered storage device as disabled (but do not export it)       

COMMAND OPTIONS:

            name            name: human-readable tier name (ex. tierA)

            device          device: device node (ex. sdtiera)

            uuid            uuid: tier uuid       


EXAMPLE:

softnas-cmd tier_disable name=tierA       

EXAMPLE:

softnas-cmd tier_disable device=sdtiera       

EXAMPLE:

softnas-cmd tier_disable uuid=5B074FFFFF23FFFF56FFFFFF

...


tier_export

        stop Stop tiered storage device if it is not in use without marking as disabled (will auto-import on reboot or takeover)       

COMMAND OPTIONS:

            name            name: human-readable tier name (ex. tierA)

            device          device: device node (ex. sdtiera)

            uuid            uuid: tier uuid       

EXAMPLE:

softnas-cmd tier_export name=tierA

...

EXAMPLE:

softnas-cmd tier_export device=sdtiera

...

EXAMPLE:

softnas-cmd tier_export uuid=5B074FFFFF23FFFF56FFFFFF

...


tier_import

        activate Activate an exported tier storage device.       

COMMAND OPTIONS:

            name            name: human-readable tier name (ex. tierA)

            uuid            uuid: tier uuid       


EXAMPLE:

softnas-cmd tier_import name=tierA

...

EXAMPLE:

softnas-cmd tier_import uuid=5B074FFFFF23FFFF56FFFFFF

...


tier_getpolicy

        display Display current storage migration policy JSON document       

COMMAND OPTIONS:

            name            name: human-readable tier name (ex. tierA)

            device          device: device node (ex. sdtiera)

            uuid            uuid: tier uuid       

EXAMPLE:

softnas-cmd tier_getpolicy name=tierA

...

EXAMPLE:

softnas-cmd tier_getpolicy device=sdtiera

...

EXAMPLE:

softnas-cmd tier_getpolicy uuid=5B074FFFFF23FFFF56FFFFFF

...


tier_setpolicy

        apply Apply new storage migration policy.       

COMMAND OPTIONS:

            name            name: human-readable tier name (ex. tierA)

            device          device: device node (ex. sdtiera)

            uuid            uuid: tier uuid

            policy          policy: JSON string encapsulated in '' (retrieve using tier_getpolicy)       

EXAMPLE:

softnas-cmd tier_setpolicy {name=tierA|device=sdtiera|uuid=5B074FFFFF23FFFF56FFFFFF} policy='[{"hit_collecttime":"23250","max_age":"46401","device":"zd0","order":"0"},{"hit_collecttime":"43200","max_age":"86400","device":"zd16","order":"1"}]'

...


tier_resize

        expand Expand tiered storage device when underlying volumes have grown.       

COMMAND OPTIONS:

            name            name: human-readable tier name (ex. tierA)

            device          device: device node (ex. sdtiera)

            uuid            uuid: tier uuid       

EXAMPLE:

softnas-cmd tier_resize name=tierA

...

EXAMPLE:

softnas-cmd tier_resize device=sdtiera

...

EXAMPLE:

softnas-cmd tier_resize uuid=5B074FFFFF23FFFF56FFFFFF

 

...


help

        Display help text.       

COMMAND OPTIONS:

            command name : Optional. You can add softnas command name to get the only help of it        EXAMPLE: If you wish to know the help content for a particular command, add the command name. 

EXAMPLE:

softnas-cmd help snaprepcommand

...