Software Development Kit (SDK) and API Discussions
Software Development Kit (SDK) and API Discussions
I'm using the NMSDK to query/calculate CPU Utilization by the various "domains".
As per the "Performance_Management Design Guide" I'm calculating the overall CPU Utilization as:
( (total_processor_busy at time2) - (total_processor_busy at time1) )
divided by
( (cpu_elapsed_time at time2) - (cpu_elapsed_time at time1)
I think I'm clear on that, HOWEVER...
The document talks about calculating the "domain" utilization using "processor_elapsed_time" and individual domain elements.
When I query "processor" for "processor_busy","processor_elapsed_time", and "domain_busy" I get 22 values for domain_busy.
e.g.:
processor0:
processor_busy:1601745213807,
processor_elapsed_time:10478611207047,
domain_busy:[8876865993240,184721625080,158518506144,450426660474,45732034856,116885108,106912,0,283367624209,2,2,344302204,9,197,0,1,243547724015,1,0,1,0,75625363564]
processor1:
processor_busy:1540858606203,
processor_elapsed_time:10478611207053,
domain_busy:[8937752600850,561047054522,32118286374,102285911150,317779435184,274074709,71085,0,54141503161,0,0,567736751,0,0,0,0,340612091470,0,0,0,0,77354069799]
What "domains" are these numbers referring to?
The Design Guide only mentions 9 domains
(Idle, Ksh, Net Stor Exem Raid Targ Netc Netc2)
and doesn't explain what those actually are (Exem & Netc?)
Is the Document out of date?
Can someone help explain the domain's?
Alan
Solved! See The Solution
Thank you again. I wasn't aware of "perf-object-counter-list-info"
I can get the label names as follows:
The code:
NaElement api = new NaElement("perf-object-counter-list-info");
api.addNewChild("objectname","processor");
NaElement xo = server.invokeElem(api);
List<NaElement> labelList = xo.getChildByName("counters").getChildren();
Iterator<NaElement> labelIter = labelList.iterator();
while (labelIter.hasNext()) {
NaElement labelData = labelIter.next();
String name = labelData.getChildContent("name");
if (name.equals("domain_busy")) {
String desc = labelData.getChildContent("desc");
System.out.printf("object: %s\n", name);
System.out.printf("descr: %s\n", desc);
List<NaElement> llist = labelData.getChildByName("labels").getChildren();
String[] labels = llist.get(0).getContent().split(",");
for (int i=0; i< labels.length; i++) {
System.out.printf("domain: %s\n", labels[i]);
}
}
}
Outputs this:
object: domain_busy
descr: Array of processor time in percentage spent in various domains
domain: idle
domain: kahuna
domain: storage
domain: exempt
domain: raid
domain: target
domain: netcache
domain: netcache2
domain: cifs
domain: wafl_exempt
domain: wafl_xcleaner
domain: sm_exempt
domain: cluster
domain: protocol
domain: nwk_exclusive
domain: nwk_exempt
domain: nwk_legacy
domain: nwk_ctx1
domain: nwk_ctx2
domain: nwk_ctx3
domain: nwk_ctx4
domain: hostOS
I can help you with what each of those 9 domains exactly are (full forms) :
Idle, kahuna, network, storage, exempt, raid, target, netcache, netcache2
Ok that helps alittle bit.
Are these 9 domains explained in the API docs anywhere?
What about the 22 domain_busy values I am getting.
Any idea what they refer to?
I do not think they are explained anywhere in NMSDK documents, I try to get an update made.
I have spoken about the 22 domain_busy values in my second answer to your question.
Hope that helps.
-Aashray
If you have 22 values then these could be the domains (in order) :
idle
kahuna
storage
exempt
raid
target
netcache
netcache2
cifs
wafl_exempt
wafl_xcleaner
sm_exempt
cluster
protocol
nwk_exclusive<
nwk_exempt
nwk_legacy
nwk_ctx1
nwk_ctx2
nwk_ctx3
nwk_ctx4
hostOS
Is there a way to determine those names programmatically?
Using the Java API I can only get the counter name (domain_busy) and the value (array of 22 values).
This code:
private static void processorData() {
xi = new NaElement("perf-object-get-instances-iter-start");
xi.addNewChild("objectname", "processor");
int max_records = 1000;
int num_records = 0;
String iter_tag = null;
try {
xo = server.invokeElem(xi);
iter_tag = xo.getChildContent("tag");
do {
xi = new NaElement("perf-object-get-instances-iter-next");
xi.addNewChild("tag", iter_tag);
xi.addNewChild("maximum", String.valueOf(max_records));
xo = server.invokeElem(xi);
num_records = xo.getChildIntValue("records", 0);
if (num_records != 0) {
List<NaElement> instList = xo.getChildByName("instances").getChildren();
Iterator<NaElement> instIter = instList.iterator();
while (instIter.hasNext()) {
NaElement instData = instIter.next();
String name = instData.getChildContent("name");
System.out.printf("instData.getChildContent(\"name\") %s\n",name);
List<NaElement> counterList = instData.getChildByName("counters").getChildren();
Iterator<NaElement> counterIter = counterList.iterator();
System.out.printf("%40s %s\n","counterData.getChildContent(\"name\")", "counterData.getChildContent(\"value\")");
while (counterIter.hasNext()) {
NaElement counterData = counterIter.next();
String counterName = counterData.getChildContent("name");
String counterValue = counterData.getChildContent("value");
System.out.printf("%40s %s\n",counterName, counterValue);
}
}
}
} while (num_records != 0);
xi = new NaElement("perf-object-get-instances-iter-end");
xi.addNewChild("tag", iter_tag);
xo = server.invokeElem(xi);
} catch (NaAuthenticationException e) {
e.printStackTrace();
} catch (NaAPIFailedException e) {
e.printStackTrace();
} catch (NaProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
Returns this:
instData.getChildContent("name") processor0
counterData.getChildContent("name") counterData.getChildContent("value")
processor_busy 2642663089976
processor_elapsed_time 23394304292437
sk_switches 1335433211
hard_switches 2863872870
domain_busy 20751641202461,361265316111,132424206122,295078365759,479661715935,893619791927,5590707042,3762326,0,29509371919,4
instData.getChildContent("name") processor1
counterData.getChildContent("name") counterData.getChildContent("value")
processor_busy 3306083491844
processor_elapsed_time 23394304292454
sk_switches 2831386867
hard_switches 1476089859
domain_busy 20088220800610,448229802758,173865471327,519108534286,1469972337348,325621952737,5665516098,29875426,0,16301861392,0
Yes this is the code that will give you information about each counter object. In your case "processor".
--------------CODE:----------------
import java.io.IOException;
import java.net.UnknownHostException;
import java.util.List;
import netapp.manage.NaElement;
import netapp.manage.NaException;
import netapp.manage.NaServer;
public class ApiClient {
public static void main(String[] args) {
try {
NaServer s = new NaServer("<my ip>", 1 , 15);
s.setServerType(NaServer.SERVER_TYPE_FILER);
s.setTransportType(NaServer.TRANSPORT_TYPE_HTTPS);
s.setPort(443);
s.setStyle(NaServer.STYLE_LOGIN_PASSWORD);
s.setAdminUser("<username>", "<password>");
NaElement api = new NaElement("perf-object-counter-list-info");
api.addNewChild("objectname","processor");
NaElement xo = s.invokeElem(api);
System.out.println(xo.toPrettyString(""));
} catch (NaException e) {
handleException(e);
} catch (UnknownHostException e) {
handleException(e);
} catch (IOException e) {
handleException(e);
}
}
private static void handleException(Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
}
----------------PART OF OUTPUT--------------
<counter-info>
<base-counter>processor_elapsed_time</base-counter>
<desc>Array of processor time in percentage spent in various domains</desc>
<labels>
<label-info>idle,kahuna,storage,exempt,raid,target,dnscache,cifs,wafl_exempt,wafl_xcleaner,sm_exempt,cluster,protocol,nwk_exclusive,nwk_exempt,nwk_legacy,hostOS</label-info>
</labels>
<name>domain_busy</name>
<privilege-level>diag</privilege-level>
<properties>percent</properties>
<type>array</type>
<unit>percent</unit>
</counter-info>
Thank you again. I wasn't aware of "perf-object-counter-list-info"
I can get the label names as follows:
The code:
NaElement api = new NaElement("perf-object-counter-list-info");
api.addNewChild("objectname","processor");
NaElement xo = server.invokeElem(api);
List<NaElement> labelList = xo.getChildByName("counters").getChildren();
Iterator<NaElement> labelIter = labelList.iterator();
while (labelIter.hasNext()) {
NaElement labelData = labelIter.next();
String name = labelData.getChildContent("name");
if (name.equals("domain_busy")) {
String desc = labelData.getChildContent("desc");
System.out.printf("object: %s\n", name);
System.out.printf("descr: %s\n", desc);
List<NaElement> llist = labelData.getChildByName("labels").getChildren();
String[] labels = llist.get(0).getContent().split(",");
for (int i=0; i< labels.length; i++) {
System.out.printf("domain: %s\n", labels[i]);
}
}
}
Outputs this:
object: domain_busy
descr: Array of processor time in percentage spent in various domains
domain: idle
domain: kahuna
domain: storage
domain: exempt
domain: raid
domain: target
domain: netcache
domain: netcache2
domain: cifs
domain: wafl_exempt
domain: wafl_xcleaner
domain: sm_exempt
domain: cluster
domain: protocol
domain: nwk_exclusive
domain: nwk_exempt
domain: nwk_legacy
domain: nwk_ctx1
domain: nwk_ctx2
domain: nwk_ctx3
domain: nwk_ctx4
domain: hostOS