NetApp Developer Session - Performance Advisor Data Extraction

by New Contributor on ‎2012-06-21 05:29 AM

Thanks to Arda for this session on deriving performance data regularly for a custom dashboard.

Use case:

Customer has a dashboard for his IT infrastructure and wants to embed NetApp storage controllers in that dashboard - nothing easier than that.

Arda explained how performance values are organized and how the values of interest are selected (see his slides down in this doc). Tailor these samples and extract what is of interest to you. For convenience, the data was taken from Performance Advisor instead of requesting them from each individual controller.

Ingredients:

Perl, Performance Advisor, NMSDK

Access the recording here:

https://netapp-learningcenter.webex.com/netapp-learningcenter/ldr.php?AT=pb&SP=MC&rID=65736702&rKey=4695f27a2ac06c4f

Here some insights:

Login to DFM Server where Performance Advisor has the data for us.

my $dfm = "dfm.server.name";

my $user = dfmuser();

my $pw  =  dfmpw();

....

# Initialize server context

my $server_ctx = NaServer->new ($dfm, 1, 0);

$server_ctx->set_transport_type("HTTP");

$server_ctx->set_style("LOGIN");

$server_ctx->set_admin_user($user, $pw);

$server_ctx->set_server_type("DFM");

$server_ctx->set_port(8088);

Back we get the $server_ctx aka server context or connection. This, plus the start and the endtime and the storage controller in question is used as input to retrieve the data. Here the value cpu_busy is extracted. Note how the information is organized and how the data structure is traversed.

sub retrieveFromTo() {

my $server_ctx = $_[0];

my $start_time = $_[1];

my $end_time = $_[2];

my $storage_system = $_[3];

my $perf_in = NaElement->new("perf-get-counter-data");

$perf_in->child_add_string("start-time", $start_time);

$perf_in->child_add_string("end-time", $end_time);

$perf_in->child_add_string("sample-rate", 300);

if ( $MAX) {

$perf_in->child_add_string("time-consolidation-method", "max");

} else {

$perf_in->child_add_string("time-consolidation-method", "average");

}

my $instance_info = NaElement->new("instance-counter-info");

$instance_info->child_add_string("object-name-or-id", $storage_system);

my $counter_info = NaElement->new("counter-info");

my $perf_obj_ctr = NaElement->new("perf-object-counter");

$perf_obj_ctr->child_add_string("object-type", "system");

$perf_obj_ctr->child_add_string("counter-name", "cpu_busy");

## "backwards" adding childs to corresponding objects

$counter_info->child_add($perf_obj_ctr);

$instance_info->child_add($counter_info);

$perf_in->child_add($instance_info);

### now that we have all data, we can invoke the API on $perf_in

my $perf_out = $server_ctx->invoke_elem($perf_in);

if($perf_out->results_status() eq "failed") {

print($perf_out->results_reason() ."\n");

exit(-2);

}

return $perf_out;

}

Outcome of this is $perf_out structure which is then processed once for getting the points when a measurement occured and once again for getting the value at that point in time.

##get the values

sub get_data_arr() {

my $perf_out = $_[0];

my @counter_arr;

my @data_arr;

my $i=0;

my $rec;

my $instance = $perf_out->child_get("perf-instances");

my @instances = $instance->children_get("perf-instance-counter-data");

foreach $rec (@instances){

my $counters = $rec->child_get("counters");

my @perf_cnt_data = $counters->children_get("perf-counter-data");

my $rec1;

foreach $rec1 (@perf_cnt_data) {

my $counter_str = $rec1->child_get_string("counter-data");

@counter_arr = split (/,/, $counter_str);

my $time_val;

foreach $time_val (@counter_arr) {

my @time_val_arr = split(/:/, $time_val);

$data_arr[$i++] = $time_val_arr[1];

}

}

}

return @data_arr;

}

##get the time array

sub get_time_arr() {

my $perf_out = $_[0];

my $rec;

my @time_arr;

my @counter_arr;

my $i=0;

my $instance = $perf_out->child_get("perf-instances");

my @instances = $instance->children_get("perf-instance-counter-data");

foreach $rec (@instances){

my $counters = $rec->child_get("counters");

my @perf_cnt_data = $counters->children_get("perf-counter-data");

my $rec1;

foreach $rec1 (@perf_cnt_data) {

my $counter_str = $rec1->child_get_string("counter-data");

@counter_arr = split (/,/, $counter_str);

my $time_val;

foreach $time_val (@counter_arr) {

my @time_val_arr = split(/:/, $time_val);

$time_arr[$i++] = $time_val_arr[0];

}

}

}

return @time_arr;

}

Having two arrays with points in time and their values we are ready to archive them and use them for customized graphing and dashboarding.

Comments
New Contributor

Excellent session, Arda! Thanx.

- Again what learned

This topic is Excellent, I am trying put the smilar kind for dashboard in my environment, Please could you help in which langugae the script is developed.

Warning!

This NetApp Community is public and open website that is indexed by search engines such as Google. Participation in the NetApp Community is voluntary. All content posted on the NetApp Community is publicly viewable and available. This includes the rich text editor which is not encrypted for https.

In accordance to our Code of Conduct and Community Terms of Use DO NOT post or attach the following:

  • Software files (compressed or uncompressed)
  • Files that require an End User License Agreement (EULA)
  • Confidential information
  • Personal data you do not want publicly available
  • Another’s personally identifiable information
  • Copyrighted materials without the permission of the copyright owner

Files and content that do not abide by the Community Terms of Use or Code of Conduct will be removed. Continued non-compliance may result in NetApp Community account restrictions or termination.