# Sample Codes

You can use DataFabric Manager APIs for the OnCommand Package to retrieve information about the DataFabric Manager server, dataset management, DataFabric Manager schedule management, creating and managing provisioning and protection policy, and so on.

The following table describes sample codes that demonstrate the use of a few DataFabric Manager APIs for the OnCommand Package. The list also provides links to view the codes.

Name | Description | Sample code in languages...
Perl | Java | C# | Powershell | C | Python | Ruby
Hello DataFabric Manager | This sample code demonstrates the following functions: Connecting to the DataFabric Manager server. Invoking a simple DataFabric Manager server API and how to retrieve the result. | hello_dfm.pl view | hello_dfm.java view | - | - | hello_dfm.c view | hello_dfm.py view | hello_dfm.rb view
DataFabric Manager proxy | This sample code demonstrates the use of the DataFabric Manager server as a proxy for the NetApp storage system. The code demonstrates the following functions: Connecting to the DataFabric Manager server. Invoking a simple Data ONTAP API and how to retrieve the result. | dfm_proxy.pl view | dfm_poxy.java view | - | - | dfm_proxy.c view | dfm_proxy.py view | dfm_proxy.rb view
Dataset management | This sample code demonstrates how to create, delete, and list datasets. It also demonstrates how to list, delete, and provision dataset members. | dataset.pl view | dataset.java view | dataset.cs view | - | - | dataset.py view | dataset.rb view
DataFabric Manager scheduling management | This sample code demonstrates how to create, list, and delete DataFabric Manager schedules. | dfm_schedule.pl view | dfm_schedule.java view | dfm_schedule.cs view | - | - | dfm_schedule.py view | dfm_schedule.rb view
Network-attached storage (NAS) provisioning policy management | This sample code demonstrates how to create, delete, and list NAS provisioning policies. | nas_provisioning_policy.pl view | nas_provisioning_policy.java view | nas_provisioning_policy.cs view | - | - | nas_provisioning_policy.py view | nas_provisioning_policy.rb view
Protection policy management | This sample code demonstrates how to create, delete, and list protection policies. | protection_policy.pl view | protection_policy.java view | protection_policy.cs view | - | - | protection_policy.py view | protection_policy.rb view
Resource pooling management | This sample code demonstrates how to create, list, and delete resource pools, and how to add, list, and remove members from a resource pool. | resource_pool.pl view | resource_pool.java view | resource_pool.cs view | - | - | resource_pool.py view | resource_pool.rb view
MultiStore management | This sample code demonstrates how to create and delete vFiler units, and how to create, list, and delete vFiler templates. | vfiler.pl view | vfiler.java view | vfiler.cs view | - | - | vfiler.py view | vfiler.rb view
Role-based access control (RBAC) by using DataFabric Manager | This sample code demonstrates how to manage an RBAC infrastructure such as how to create, delete, and list roles, operations, and so on. | rbac.pl view | rbac.java view | rbac.cs view | - | - | rbac.py view | rbac.rb view
About DataFabric Manager | This sample code demonstrates how to retrieve information about the DataFabric Manager server, such as CPU count, server name, node limit, and so on. | - | - | - | GetDfmAbout.cs view | - | - | Get_DfmAbout view
Schedule information | This sample code demonstrates how to retrieve information about all data protection schedules. | - | - | - | GetDpScheduleListInfo.cs view | - | - | Get_DpScheduleListInfo view

The following are advanced sample codes in Perl and Java:

Use Case | Name | Description | Sample code in languages.. |  |
Perl | Java | Python | Ruby
Policy-based provisioning and protection | Dataset management | This sample code demonstrates how to create, list, and delete a dataset. It also demonstrates how to add, list, and delete a member in a dataset, attach resource pools, provisioning policy, protection policy, and vFiler to a dataset, and provision storage from a dataset. | dataset.pl view | dataset.java view | dataset.py view | dataset.rb view
MultiStore management | This sample code demonstrates how to create, destroy, and set up a vFiler unit. | multistore.pl view | multistore.java view | multistore.py view | multistore.rb view
Provisioning policy management | This sample code demonstrates how to list and delete protection policies, and how to create, list, and delete a new provisioning policy. | policy.pl view | policy.java view | policy.py view | policy.rb view
Resource pooling management | This sample code demonstrates how to create, list, and delete a resource pool, and how to add and list members to and delete members from a resource pool. | resource_pool.pl view | resource_pool.java view | resource_pool.py view | resource_pool.rb view
Dataset monitoring | Health monitoring | This sample code demonstrates how to provide the health status of datasets in a system, and how to collect information about total protected and unprotected datasets, and dataset protection status, space status, conformance status, resource status, and so on. | dataset_health.pl view | dataset_health.java view | dataset_health.py view | dataset_health.rb view
Space monitoring | This sample code demonstrates how to obtain the storage information of each dataset, such as used space, available space, and total space of each node in the dataset. It also provides information about space breakout and deduplicated space savings for each dataset member. | dataset_metrics.pl view | dataset_metrics.java view | - | -
Performance characteristics (views) for latency, input and output operations per second, and CPU utilization | Aggregate latency | This sample code provides information about read latency, write latency, and average latency of an aggregate. Performance Advisor does not provide counters to get aggregate latency directly. This sample code demonstrates a method to generate aggregate latency data by collecting the latency of all the volumes present in the aggregate. This data can be used to generate charts to represent data in graphical format. To generate the graph, you have to redirect the output of this sample code to an Excel sheet. | perf_aggr_latency.pl view | perfAggrLatency.java view | perf_aggr_latency.py view | perf_aggr_latency.rb view
Volume Latency | This sample code prints the average latency of all the volumes present for the aggregate. This data can be used to generate a distribution chart for average latency of a volume. To generate the graph, you have to redirect the output of this sample code to an Excel sheet. | perf_vol_latency.pl view | perfVolLatency.java view | perf_vol_latency.py view | perf_vol_latency.rb view
Disk Latency | This sample code prints disk Input Output Per second (IOPs) for all disks on which an aggregate is present. This sample code also prints the minimum disk IOPs value and the maximum disk IOPs value for the specific time stamp. | perf_disk_iops_latency.pl view | perfDiskLatency.java view | perfDiskLatency.py view | perfDiskLatency.rb view
CPU utilization | This sample code prints CPU utilization statistics of a storage system. The sample code collects CPU utilization data for two weeks and prints the data in a format that enables comparison of CPU utilization in day-hour format for both the weeks. The output data of this sample code can be used to generate chart. To generate the graph, you have to redirect the output of this sample code to an Excel sheet. | perf_cpu_util.pl view | perfCpuUtil.java view | perfCpuUtil.py view | perfCpuUtil.rb view