Software Development Kit (SDK) and API Discussions

Using Java NM API to collect event information

RAYMOND_TANG
8,916 Views

Hi! All,

I am writing a program to collect netapp information. When I try to find a way to collect the event, problem raised.

I would like to list the events from my UI but I cannot found sample codes to it. All I knew is accessing ems command in console, listing the events.

Is there a way to do it in Java using the API? Thanks!

Raymond

10 REPLIES 10

aashray
8,886 Views

Are you using DATA ONTAP or OnCommand? which version?

-Aashray

RAYMOND_TANG
8,886 Views

Thanks for your reply, I am using netapp-manageability-sdk-4.1 and using ontap simulator 7.3.6.

Raymond

aashray
8,886 Views

Raymond,

I dont have a very clear understanding of your question. But if you are looking to invoke an ems event from the Java API, then the API to be used would be ems-invoke.

Sample Code, taken from ZEDI (which can help automatically generate code)  :

public static void main(String[] args) {

                    try {

                              NaServer s = new NaServer("<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("user", "<password>");

                              NaElement api = new NaElement("ems-invoke");

                              api.addNewChild("event-id","<event-id>");

                              api.addNewChild("event-version","<event-version>");

                              NaElement xi = new NaElement("params");

                              api.addNewChild(xi);

                              xi.addNewChild("param","<param>");

                              api.addNewChild("severity","<severity>");

                              api.addNewChild("snmp","<snmp>");

                              api.addNewChild("syslog","<syslog>");

                              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);

                    }

Let me know your query more descriptively incase I'm off track.

-Aashray

RAYMOND_TANG
8,886 Views

Thanks for your reply again. I have moved the sdk to version 5.0 and API to 8.1 (using manageontap-5.0.jar and ontap-api-8.1.jar).

I think the content I want to collect like this, just not know the API can do this or not and how.

netappsim> ems event status

Event:Priority                           Last Time       Indications  Drops        DupSuppr     TimerSuppr   AutoSuppr  

api.input.invalidSchema:WARN             21Nov2012 17:12:26      6            0            0            0            0          

cf.fm.missingAdapter:ERR                 21Nov2012 16:50:50      1            0            0            0            0          

cifs.startup.stats:INFO                  21Nov2012 16:50:50      1            0            0            0            0  

Raymond

aashray
8,886 Views

Do you have a cluster mode setup or 7-mode?

aashray
8,887 Views

If its Cluster Mode then the API you are looking for is "ems-status-get".

RAYMOND_TANG
8,887 Views

I think I haven't setup cluster or 7-mode. What can I do if not using those setup to get the event information?

aashray
5,514 Views

Your setup would be running as 7-mode or cluster-mode. NMSDK APIs are different for each of these modes running on the filer or simulator that you have.

aashray
8,886 Views

Also if you're working with events, OnCommand is a great NetApp Manageability product that can help you.http://www.netapp.com/in/products/management-software/oncommand/oncommand-overview-in.html. It will help you automate your management tasks.

RAYMOND_TANG
8,886 Views

Thanks for the link, I am going to read through it.

Public