Active IQ Unified Manager Discussions

perf-view-create error 'charts not supplied'

chris_algar

I'm using perf-view-create to create a new perf view in DFM (5.0.2P1) via the SDK. I supply this XML:

$VAR1 = bless( {

                 'content' => '',

                 'name' => 'perf-view-create',

                 'children' => [

                                 bless( {

                                          'content' => '',

                                          'name' => 'view',

                                          'children' => [

                                                          bless( {

                                                                   'content' => '',

                                                                   'name' => 'perf-view',

                                                                   'children' => [

                                                                                   bless( {

                                                                                            'content' => 'Flash Cache lnn99 (extended)',

                                                                                            'name' => 'view-name',

                                                                                            'children' => [],

                                                                                            'attrvals' => [],

                                                                                            'attrkeys' => []

                                                                                          }, 'NetAppApi::NaElement' )

                                                                                 ],

                                                                   'attrvals' => [],

                                                                   'attrkeys' => []

                                                                 }, 'NetAppApi::NaElement' )

                                                        ],

                                          'attrvals' => [],

                                          'attrkeys' => []

                                        }, 'NetAppApi::NaElement' )

                               ],

                 'attrvals' => [],

                 'attrkeys' => []

               }, 'NetAppApi::NaElement' );

But get an error back that looks like this:

$VAR1 = bless( {

                 'content' => '',

                 'name' => 'results',

                 'children' => [],

                 'attrvals' => [

                                 'charts not supplied',

                                 '13115',

                                 'failed'

                               ],

                 'attrkeys' => [

                                 'reason',

                                 'errno',

                                 'status'

                               ]

               }, 'NetAppApi::NaElement' );

This is strange because the SDK documentation says that 'charts' is optional in perf-view-create.

chartsperf-chart[]
optional
The charts (graphs) appearing in this view. 

I don't want to specify any charts at this part of my code, I want to create an empty view that I will subsequently add multiple charts to.

Is this a bug?

6 REPLIES 6

chris_algar

note - I seem to be able to do the equivalent operation from the CLI (I can create an empty view):

algarch@npias10 $ /var/hostlinks/NTAPdfm/wrappers/dfm perf view create "Flash Cache lnn30 (extended)"

View Flash Cache lnn30 (extended) created successfully.

And add an empty chart to it:

algarch@npias10 $ /var/hostlinks/NTAPdfm/wrappers/dfm perf view chart add "Flash Cache lnn30 (extended)" "Flash Cache Hit Percent"

Successfully added chart Flash Cache Hit Percent to view Flash Cache lnn30 (extended).

To which I can then add a counter:

/var/hostlinks/NTAPdfm/wrappers/dfm perf view counter add -n lnn30oznp1 -i ec0 "Flash Cache lnn30 (extended)" "Flash Cache Hit Percent" ext_cache_obj:hit_percent

Counter added successfully.

Which is the sequence that I am trying to acheive via the API. I would expect the functionality of the API to be as capable as the CLI. can anyone advise on how to do this via the API?

Thanks,

Chris

adaikkap

Hi Chris,

           The cli in the backend calls the API only. Run the cli and do a tail of the audit.log file to see how the apis are used.

Regards

adai

chris_algar

Thanks for the advice.

I called the CLI command "dfm  perf view create test" and the audit log entry is:

Jun 27 06:50:29 [dfm:NOTIC]: root:API:in:[127.0.0.1]:Create a performance view:<perf-view-create>  <view>   <perf-view>    <view-name>test</view-name>    <are-events-shown>false</are-events-shown>    <view-type>custom_view_instances</view-type>    <charts/>   </perf-view>  </view> </perf-view-create>

Jun 27 06:50:29 [perf:NOTIC]: root:CMD:in:[127.0.0.1]:perf view create test:View test created successfully.<BR>

I'm puzzled as to why the <charts/> mark up is included. This does't look like well formed XML to me. Is the CLI working around a bug with the API? <charts/> is not somthing I will be able to reproduce with the standard SDK methods.

adaikkap

Hi Chris,

     I spoke to one of the long timer of Performance Advisor on the same.

  1. The XML of <charts/> is correct. It is same as <charts>value</charts>
  2. Also the SDK documentation is incorrect. Charts is not a optional element.

Regards

adai

chris_algar

So you are using <charts/> as an empty element tag. The documentation says that charts is an optional element, but you are saying that is required as an empty element tag.

However, I do not see a way to add an empty element tag to the XML using the SDK methods. If I use this:

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

 

        my $perf_view = NetAppApi::NaElement->new("perf-view");

           $perf_view->child_add_string("view-name", $name);

           $perf_view->child_add($charts);

 

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

 

           $view->child_add($perf_view);

 

        my $create = NetAppApi::NaElement->new("perf-view-create");

           $create->child_add($view)

To submit the XML:

$VAR1 = bless( {

                 'content' => '',

                 'name' => 'perf-view-create',

                 'children' => [

                                 bless( {

                                          'content' => '',

                                          'name' => 'view',

                                          'children' => [

                                                          bless( {

                                                                   'content' => '',

                                                                   'name' => 'perf-view',

                                                                   'children' => [

                                                                                   bless( {

                                                                                            'content' => 'Flash Cache lnn99 (extended)',

                                                                                            'name' => 'view-name',

                                                                                            'children' => [],

                                                                                            'attrvals' => [],

                                                                                            'attrkeys' => []

                                                                                          }, 'NetAppApi::NaElement' ),

                                                                                   bless( {

                                                                                            'content' => '',

                                                                                            'name' => 'charts',

                                                                                            'children' => [],

                                                                                            'attrvals' => [],

                                                                                            'attrkeys' => []

                                                                                          }, 'NetAppApi::NaElement' )

                                                                                 ],

                                                                   'attrvals' => [],

                                                                   'attrkeys' => []

                                                                 }, 'NetAppApi::NaElement' )

                                                        ],

                                          'attrvals' => [],

                                          'attrkeys' => []

                                        }, 'NetAppApi::NaElement' )

                               ],

                 'attrvals' => [],

                 'attrkeys' => []

               }, 'NetAppApi::NaElement' );

Then I get an undefined error in response:

$VAR1 = bless( {

                 'content' => '',

                 'name' => 'results',

                 'children' => [],

                 'attrvals' => [

                                 '',

                                 '13001',

                                 'failed'

                               ],

                 'attrkeys' => [

                                 'reason',

                                 'errno',

                                 'status'

                               ]

               }, 'NetAppApi::NaElement' );

So that is not a valid way to specify an empty element tag.

If I add a chart then my error just changes to the level below, the first named chart generates an error that there are no lines specified (again this should be optional).

So I don't think that the empty element tag <charts/> should be required, and enforced, by the filer. This is more than just a documentation issue. I guess I could work around it for now, but I will need to know how to add the empty element tag to the NaElement object. Is there an SDK method to do that?

Thanks,

Chris

aashray

Hi Chris,

It is a documentation error that I am working towards getting corrected. Charts is not optional. I have a work around for you :

I can see from your code that you add charts as a child to perf-view. You need to use child_add_string instead just like you need to for the view-name parameter.

Here is a working code :

___________________________________________________________________________

my $api = new NaElement('perf-view-create');

my $xi = new NaElement('view');

$api->child_add($xi);

my $xi1 = new NaElement('perf-view');

$xi->child_add($xi1);

$xi1->child_add_string('charts',' ');

$xi1->child_add_string('view-name','test');

$xi1->child_add_string('view-type','custom_view_instances');

$xi1->child_add_string('are-events-shown','false');

my $xo = $s->invoke_elem($api);

if ($xo->results_status() eq 'failed') {

    print 'Error:\n';

    print $xo->sprintf();

    exit 1;

}

print 'Received:\n';

print $xo->sprintf();

__________________________________________________________________

This should work, Please let me know if it does.

____________________________________________

The XML :

<perf-view-create>

   

    <view>

      <perf-view>

        <charts>

        </charts>

        <view-name>test</view-name>

        <view-type>custom_view_instances</view-type>

        <are-events-shown>false</are-events-shown>

      </perf-view>

    </view>

  </perf-view-create>

_______________________________________________

Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public