Subscribe
Accepted Solution

perf-threshold-template-attach-objects syntax?

Having problems using perf-threshold-template-attach-objects to add an object (volume) to an existing threshold template. I'd like to know if I am doing this wrong (and hosw to fix it), or if there is a problem with the API.

I'm using the perl API and the code looks like this:

my $obj_info = NetAppApi::NaElement->new("object-info");

      $obj_info->child_add_string("object-id", $volume->get_id()):

      $obj_info->child_add_string("object-type", 'volume');

my $new_objs = NetAppApi::NaElement->new("new-objects");

     $new_objs->child_add($obj_info);

my $cmd = NetAppApi::NaElement->new("perf-threshold-template-attach-objects");

     $cmd->child_add_sting("template-name-or-id", $self->get_id());

     $cmd->child_add($new_objs);

my $output = $serv->invoke($cmd);

The error I get back is 'Extra content at en of the document', so I suspect I'm constructing the cmd incorrectly. Any pointers?

The equivalent CLI does work:

./dfm perf template attach 2 12974

Attached object to the template

where 2 it the threshold template id and 12974 is a volume object id.

perf-threshold-template-attach-objects syntax?

The XML request sent by the CLI to the dfm server will be logged into audit.log file (in /opt/NTAPdfm/log directory by default). The XML request you have created can be dumped using sprintf member function. Using these two dumps, you should be able to figure out the issue with the perl script.

Regards

Harish

perf-threshold-template-attach-objects syntax?

The audit log shows the CLI version as:

Aug 09 15:01:14 [Unknown:NOTIC]: algarch:API:in:[127.0.0.1]::<perf-threshold-template-attach-bjects>  <new-objects>  <object-info>  <object-is>12974</object-id>  </object-info>  </new-objects>  <template-name-or-id>2</template-name-or-id> </perf-threshold-template-attach-objects>

Aug 09 15:01:14 [Unknown:NOTIC]: algarch:API:in:[127.0.0.1]::        12974      2 Aug 09 15:01:14 [perf:NOTIC]: algarch:CMD:in:[127.0.0.1]:perf template attach 2 12974:Attached object to the template.

Which looks like the same XML I am attempting to send via the API.


But the API call only inserts an error in the audit.log, no indication of what was received is written there:

Aug 09 15:13:14 [Unknown:NOTIC]: dfmapi:API:err:[172.24.1.136]::Extra content at the end of the document

perf-threshold-template-attach-objects syntax?

Could you please dump the XML request you created from the perl script using NaElement->sprintf() function?

perf-threshold-template-attach-objects syntax?

$cmd->sprintf() returns somthing that looks like:

'<perl-threshold-template-attach-objects>

<template-name-or-id>2</template-name-or-id>

<new-objects>

             <object-info>

                         <object-id>12974</object-id>

                         <object-type>volume</object-type>

              </object-info>

</new-objects>

</perf-threshold-template-attach-objects>';

Which matches my reading of the API documentation. Any ideas?

perf-threshold-template-attach-objects syntax?

From cli:

<perf-threshold-template-attach-objects>

  <new-objects>

    <object-info>

      <object-id>12974</object-id>

    </object-info>

  </new-objects>

  <template-name-or-id>2</template-name-or-id>

</perf-threshold-template-attach-objects>

From perl script:

<perl-threshold-template-attach-objects>

   <template-name-or-id>2</template-name-or-id>

   <new-objects>

       <object-info>

          <object-id>12974</object-id>

          <object-type>volume</object-type>

       </object-info>

   </new-objects>

</perf-threshold-template-attach-objects>

The difference I see is the extra "object-type" tag in the perl script and the incorrectly spelt first line (perl instead of perf). I changed perl to perf and I am able to attach object to the template. Is the serv (the server object) configured properly? Are you able to execute any other zapi requests using

this serv object?

Re: perf-threshold-template-attach-objects syntax?

The perl instead of perf is just a typo in this web form. It's "perf" in the XML.

object-type is optional according to the docs. If I remove it the error does not change.

$VAR1 = ' <perf-threshold-template-attach-objects>

                 <template-name-or-id>2</template-name-or-id>

                 <new-objects>

                              <object-info>

                                          <object-id>12974</object-id>

                               </object-info>

                  </new-objects>

</perf-threshold-template-attach-objects>                     

The $serv obect is an NaServer object. It works for many other calls.

perf-threshold-template-attach-objects syntax?

Did you try using apitest ? Could you try executing your XML through spitest and see, if you get the same error.

perf-threshold-template-attach-objects syntax?

is apitest applicable to dfm api calls? It works for me against filers, but not against DFM.

Are you able to use the perf-threshold-template-attach-objects method? Can you validate that it works as documented for the perl API? I'm a bit stuck otherwise and this is blocking dev.

Thanks,

Chris

perf-threshold-template-attach-objects syntax?

Has anyone been able to validate that the documentation and function of this method are correct? The same syntax for perf-threshold-template-detach-objects works ok, so I am still stuck on why perf-threshold-template-attach-objects does not.

Just getting back to the dev of this system and I'm blocked on this issue.

Chris