The transition to NetApp MS Azure AD B2C is complete. If you missed the pre-registration, you will be invited to register at next log in.
Please note that access to your NetApp data may take up to 1 hour.
To learn more, read the FAQ and watch the video.
Need assistance? Complete this form and select “Registration Issue” as the Feedback Category.

Software Development Kit (SDK) and API Discussions

Using Java NM API to collect event information

RAYMOND_TANG

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

Are you using DATA ONTAP or OnCommand? which version?

-Aashray

RAYMOND_TANG

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

Raymond

aashray

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

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

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

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

aashray

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

RAYMOND_TANG

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

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

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

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