This is already asked for in RFE 488456.
One way to get traction is to open up cases and have support attach to that bug number. ☺
From: Weber, Mark A [mailto:mark-a-weber@uiowa.edu] Sent: Thursday, May 14, 2015 12:54 PM To: Parisi, Justin; toasters@teaparty.net Subject: RE: Using noninteractive ssh in Clustered Data Ontap
Justin – any way you can push on someone to get -sort-by moved to admin instead of diag? I don’t really see why sorting output is a diagnostic level thing.
thanks m
From: toasters-bounces@teaparty.netmailto:toasters-bounces@teaparty.net [mailto:toasters-bounces@teaparty.net] On Behalf Of Parisi, Justin Sent: Thursday, May 14, 2015 10:03 AM To: Parisi, Justin; Basil; toasters@teaparty.netmailto:toasters@teaparty.net Subject: RE: Using noninteractive ssh in Clustered Data Ontap
My volumes are all tiny, so MB works better to illustrate. ☺
# ssh ssh@10.63.3.67mailto:ssh@10.63.3.67 "set diag -confirmations off; set -units MB; vol show -sort-by size"
(volume show) Vserver Volume Aggregate State Type Size Available Used% --------- ------------ ------------ ---------- ---- ---------- ---------- ----- SN-TRUST unix aggr1 online RW 20MB 18MB 5% SN-TRUST vsroot aggr1 online RW 20MB 18MB 5% SVM home aggr1 online RW 20MB 18MB 5% SVM mixed aggr1 online RW 20MB 18MB 5% SVM nfs4 aggr1 online RW 20MB 18MB 5% SVM ntfs aggr1 online RW 20MB 18MB 5% SVM rootvol aggr1 online RW 20MB 18MB 5% SVM symlinks aggr1 online RW 20MB 18MB 5% nfs_svm rootvol aggr1 online RW 20MB 18MB 5% nfs_svm vol1 aggr1 online RW 20MB 18MB 5% SVM matt aggr1 online RW 100MB 94MB 5% SVM unix2 aggr2 online RW 100MB 94MB 5% SVM unix aggr1 online RW 710MB 570MB 19% parisi-cdot-02 vol0 aggr0_parisi_cdot_02_0 online RW 3082MB 1018MB 66% parisi-cdot-01 vol0 aggr0 online RW 3481MB 483MB 86% 15 entries were displayed.
From: toasters-bounces@teaparty.netmailto:toasters-bounces@teaparty.net [mailto:toasters-bounces@teaparty.net] On Behalf Of Parisi, Justin Sent: Thursday, May 14, 2015 11:01 AM To: Basil; toasters@teaparty.netmailto:toasters@teaparty.net Subject: RE: Using noninteractive ssh in Clustered Data Ontap
Try this:
# ssh ssh@10.63.3.67mailto:ssh@10.63.3.67 "set diag -confirmations off; set -units GB; vol show -sort-by size"
(volume show) Vserver Volume Aggregate State Type Size Available Used% --------- ------------ ------------ ---------- ---- ---------- ---------- ----- SN-TRUST unix aggr1 online RW 0GB 0GB 5% SN-TRUST vsroot aggr1 online RW 0GB 0GB 5% SVM home aggr1 online RW 0GB 0GB 5% SVM mixed aggr1 online RW 0GB 0GB 5% SVM nfs4 aggr1 online RW 0GB 0GB 5% SVM ntfs aggr1 online RW 0GB 0GB 5% SVM rootvol aggr1 online RW 0GB 0GB 5% SVM symlinks aggr1 online RW 0GB 0GB 5% nfs_svm rootvol aggr1 online RW 0GB 0GB 5% nfs_svm vol1 aggr1 online RW 0GB 0GB 5% SVM matt aggr1 online RW 0GB 0GB 5% SVM unix2 aggr2 online RW 0GB 0GB 5% SVM unix aggr1 online RW 0GB 0GB 19% parisi-cdot-02 vol0 aggr0_parisi_cdot_02_0 online RW 3GB 0GB 66% parisi-cdot-01 vol0 aggr0 online RW 3GB 0GB 86% 15 entries were displayed.
From: toasters-bounces@teaparty.netmailto:toasters-bounces@teaparty.net [mailto:toasters-bounces@teaparty.net] On Behalf Of Basil Sent: Thursday, May 14, 2015 10:49 AM To: toasters@teaparty.netmailto:toasters@teaparty.net Subject: Using noninteractive ssh in Clustered Data Ontap
I'm trying to use CDOT noninteractively from bash, but running into trouble. Let's say for example you wanted to get a list of volumes on an SVM and then sort by size- there's no sort in the interactive CLI and it asks you to enter text every page of results, so my initial thought was to send the command noninteractively and do what I need done in bash. If you send the command "ssh user@nas volume show -vserver whatever", you get a nicely formatted table without any of the line-splitting, confirmations, or other interactive shell nonsense:
Vserver Volume Aggregate State Type Size Available Used% --------- ------------ ------------ ---------- ---- ---------- ---------- ----- svm vol1 aggr1 online RW 2TB 2.00TB 0% svm vol2 aggr1 online RW 100GB 100.00GB 0%
This is much better, but I still can't use the size field to sort unless I can change it all to the same unit. If this were an interactive session, I'd use "set -units GB", however it's not. How can I accomplish that non-interactively? Can I send multiple commands in one ssh command?
One thing that should work but doesn't is creating a list of commands that will run and sending them via ssh-
me@myserver:/home/me $ cat temp set -units KB volume show -vserver svm -volume *root me@myserver:/home/me $ ssh admin@nas < temp Pseudo-terminal will not be allocated because stdin is not a terminal. nas::> set -units KB
nas::> volume show -vserver svm -volume *root Vserver Volume Aggregate State Type Size Available Used% --------- ------------ ------------ ---------- ---- ---------- ---------- ----- svm svm_root aggr1 online RW 1048576KB 995796KB 5%
nas::>
me@myserver:/home/me $
As you see, as soon as it detects multiple lines, it switches back to the interactive shell. If I had use something with more than a single line of output, it would have given me a couple of lines, asked for "confirmation", and then exited. All the while putting "readability" whitespace inconsistently all over the results.
Any ideas?
Basil