filestats command is available in CLI (an example below):
[root]# rsh myfiler filestats volume myvolume snapshot mysnapshot
VOL=myvolume SNAPSHOT=mysnapshot
INODES=983031 COUNTED_INODES=39845 TOTAL_BYTES=8725924057 TOTAL_KB=8586296
...
I am trying to run the same command using system-cli API. The API runs fine, no error is reported, but, I can't see any output in "cli-output".
use NaServer;
use NaElement;
use Data::Dumper;
my $filer = "myfiler";
my $volume = "myvolume";
my $snapshot = "mysnapshot";
my $user = "<user>";
my $passwd = "<passwd>";
my $api = NaServer->new( $filer, 1, 4 );
$api->set_style("LOGIN");
$api->set_admin_user($user, $passwd);
$api->set_transport_type(NA_SERVER_TRANSPORT_HTTP);
my $cmd = new NaElement('system-cli');
my $cmd_args = new NaElement('args');
my @arg_arr = ('filestats', 'volume', $volume, 'snapshot', $snapshot);
foreach my $arg (@arg_arr)
{
$cmd_args->child_add(new NaElement('arg', $arg));
}
$cmd->child_add($cmd_args);
my $result = $api->invoke_elem($cmd);
print "Result ". Dumper($result) . "\n";
if ($result->results_errno != 0)
{
my $reason = $out->results_reason();
print "Invoke Failed: $reason\n";
}
my $output = $result->child_get_string("cli-output");
print "Output: " . Dumper($output) . "\n";
When I run this script, I see:
% perl test_filestats.pl
Result $VAR1 = bless( {
'content' => '',
'name' => 'results',
'children' => [
bless( {
'content' => '',
'name' => 'cli-output',
'children' => [],
'attrvals' => [],
'attrkeys' => []
}, 'NaElement' ),
bless( {
'content' => '1',
'name' => 'cli-result-value',
'children' => [],
'attrvals' => [],
'attrkeys' => []
}, 'NaElement' )
],
'attrvals' => [
'passed'
],
'attrkeys' => [
'status'
]
}, 'NaElement' );
Output: $VAR1 = '';
So, there is no error, but, no output either. Am I invoking the API in a wrong way? How to get the output of filestats command through system-cli call?
Thanks,
Haritha