Thank you to everyone who gave me help and assistance on this one. There's several useful suggestions to workaround the fact that the API would need multiple passes.
The most useful being - SNMP does it.
However I've also managed to dig something out that I thought I'd share - there's an undocumented API (which I'm sure you will all be wise enough to use at your own risk!)
system-cli
Which allows you to execute commands via the API auth mechanism.
<!DOCTYPE netapp SYSTEM "/na_admin/netapp_filer.dtd"><netapp version="1.7" xmlns="http://www.netapp.com/filer/admin"> <system-cli> <args> <arg>df</arg> <arg>-k</arg> </args> </system-cli></netapp>
As an example (and apologies if this format mashes - it's perl, run it through perltidy again and it'll be fine). This _doesn't_ use the NetApp SDK, but rather the two CPAN modules 'LWP' and 'XML::Twig'. Both are readily available, and personally I find them altogether easier to work with. (YMMV of course).
The downside is - you get back a single 'cli-output' element that's plain text formatted, so has all the downsides of 'ssh $host df -k'.
(I don't know if that changes in CDOT, but one of my feature requests would be enabling XML/CSV output from all NetApp commands - I've used another vendor's stuff, and this sort of thing is a real boon)
#!/usr/bin/env perl use strict; use warnings;
use XML::Twig; use LWP;
my $twig = XML::Twig->new( 'pretty_print' => 'indented' ); $twig->set_root( XML::Twig::Elt->new( 'netapp', { version => 1.7, vfiler => "somevfiler", xmlns => "http://www.netapp.com/filer/admin", }, ) ); my $api_req = $twig->root->insert_new_elt('system-cli'); my $args = $api_req->insert_new_elt('args'); $args->insert_new_elt( 'last_child', 'arg', 'df' ); $args->insert_new_elt( 'last_child', 'arg', '-k' );
$twig->set_doctype('netapp SYSTEM "file:/etc/netapp_filer.dtd"'); $twig->set_xml_version("1.0"); $twig->set_encoding('utf-8');
$twig->print;
exit;
my $user_agent = LWP::UserAgent->new( 'ssl_opts' => { 'verify_hostname' => 0, 'SSL_version' => 'SSLv3', } );
my $request = HTTP::Request->new( 'POST' => 'https://myfilername/servlets/netapp.servlets.admin.XMLrequest_filer ' ); $request->authorization_basic( 'username_here', 'password_here' ); $request->content( $twig->sprint );
my $results = $user_agent->request($request); if ( not $results->is_success ) { print "Error: ", $results->status_line; exit; }
my $results_xml = XML::Twig->new( 'pretty_print' => 'indented_a' ); $results_xml->parse( $results->content ); $results_xml->print;
On 23 April 2015 at 13:58, Edward Rolison ed.rolison@gmail.com wrote:
I'm currently fiddling with a project using the ONTAPI (perf stats monitoring sort of thing).
What I'm wanting to do is reproduce the information from 'df' and 'df -s'.
Doing well so far, because the api 'volume-list-info' seems to have most of the information I want. There's just one thing missing - how much of the 'snap reserve' I'm actually using.
I can't seem to find it in either that, or the 'snapshot' counters. I would ideally be able to do this without having to do a per-volume calculation, because one of the things I'm hoping to do is support a lightweight proxy client that 'just' fetches source XML for processing on a server.
Or is there a way I can calculate this from the size/used/available in the volume-list-info?
Thanks, Ed