Have you looked at the NetApp Management SDK, or is that too large of a hammer for your needs?

Francis Kim | Engineer
510-644-1599 x334 | fkim@berkcom.com
 
BerkCom | www.berkcom.com
NetApp | Cisco | Supermicro | Brocade | VMware

On May 14, 2015, at 11:45 AM, Basil <basilberntsen@gmail.com> wrote:

I might open one, then. Interactive is fine for some things, but any time you want to automate or do large numbers of something, it is easier to use non-interactive commands- you can't use loops, string editing, or multiple systems from inside an interactive shell.

On Thu, May 14, 2015 at 2:24 PM, Maarten Lippmann <maarten@lippmann.us> wrote:
Reading back on the thread, there are really 2 asks here, both asks are
relevant and both a would cover this particular use-case, however both
would also be more valid for other things.

1. the sort option inside cDOT as a command that can be used in admin
level non-interactive sessions. Obviously the single column sort is
useful, but it'd be awesomer if you can sort by multiple columns (e.g.
group by SVMs, then sort by size, so volumes owned by different SVMs are
not sorted together) that's RFE 488456 Justin called out.

2. a second ask, that would cover this as well, would be to have the set
flags (-set data units, etc.) be persistent for a given user. If I always
want my size in bytes for interactive and noninteractive sessions, I
should be able to set that once, and future logins for that same user will
always do this. If you do that, then sed/awk/sort/etc. will be able to
solve this problem easily (and many more) as well. This would be burt
500834.

Completely agree with Justin. Open cases on this if you want either or
both of these features implemented.

> 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.net<mailto: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.net<mailto: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.67<mailto: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.net<mailto: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.net<mailto:toasters@teaparty.net>
> Subject: RE: Using noninteractive ssh in Clustered Data Ontap
>
> Try this:
>
> # ssh ssh@10.63.3.67<mailto: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.net<mailto:toasters-bounces@teaparty.net>
> [mailto:toasters-bounces@teaparty.net] On Behalf Of Basil
> Sent: Thursday, May 14, 2015 10:49 AM
> To: toasters@teaparty.net<mailto: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
> _______________________________________________
> Toasters mailing list
> Toasters@teaparty.net
> http://www.teaparty.net/mailman/listinfo/toasters
>


_______________________________________________
Toasters mailing list
Toasters@teaparty.net
http://www.teaparty.net/mailman/listinfo/toasters

_______________________________________________
Toasters mailing list
Toasters@teaparty.net
http://www.teaparty.net/mailman/listinfo/toasters