Application Perf Mgmt (BAC / BSM) Practitioners Forum
Showing results for 
Search instead for 
Do you mean 

Create an Event via OMi API

SOLVED
Go to Solution
Highlighted
Advisor

Create an Event via OMi API

If an error occurs in an Operations Orchestration flow I would like to create an OMi event within the flow via the OMi API (in exactly the same way as SiteScope can send an event on error).

 

I can't work out how to create this event. This is from the Operations Manager i Extensibility Guide:

 

How to Create New Events: You can create new events using the RestWsUtil command-line utility

 

But can this be done simply via the REST client without RestWsUtil? And is this the creation of a new event or a new event type?

 

Thanks,

 

David

7 REPLIES
HPE Expert

Re: Create an Event via OMi API

OMi Web Service allows to create actual events, not event types.

RestWsUtil is simply a wrapper utility and significantly simplifies using this REST API. If you prefer more complex approaches nothing prevents you from doing so. API is just API regardless of the way you use it.

 

Event Web Service Java API Documentation can be found at HPBSM/opr/api/doc/opr-external-api-javadoc.zip

Advisor

Re: Create an Event via OMi API

Thanks. I have successfully created an event with using RestWsUtil i.e. RestWsUtil -create c:\my.xml etc, where my.xml is the same as the example in the doc:

 

<event xmlns="http://www.hp.com/2009/software/opr/data_model">
<title>My very own event</title>
<severity>normal</severity>
<priority>low</priority>
<state>open</state>
</event>

 

This worked. But I then tried to do the same thing using a REST client in Firefox. It is this which I cannot find in the documentation. Here is the URL I used:

http://our saas site/opr-console/rest/9.10/event_list/

 

I gave it the same authorization as in the RestWsUtil, added the content-type and in the body entered the same xml as above.

 

Is this the correct form of the URL and body?

 

(I get a 403 access is denied error. I do have permissions though and they are the same as in the RestWsUtil call).

 

Regards,

 

David

HPE Expert

Re: Create an Event via OMi API

Do you set X-Secure-Modify-Token HTTP header?

If not, did you disable 

Infrastructure Settings > Applications = Operations Management

Operations Management - Web Service Settings > Secure Modify?

Advisor

Re: Create an Event via OMi API

I did not set this header.
Thanks for the great support Dmitry
Advisor

Re: Create an Event via OMi API

Hi Dmitry,

 

Thanks for that, however if you want to keep the web service security enabled, how do I know what to set X-Secure-Modify to?  The BSM/OMi Extensibility document appears to give no hints on what it should be.

 

Thanks heaps,

Warren

HPE Expert

Re: Create an Event via OMi API

Please check the Extensibility guide again, it's more than clear on that subject. Here is a quote:

 

Web Service clients must first obtain the secureModifyToken cookie, and then set the value of the cookie in the

X-Secure-Modify-Token HTTP header.

Frequent Advisor

Re: Create an Event via OMi API

[ Edited ]

Guys, how to make RestWsUtil.bat more verbose? I am trying to create new event over REST API but get the same error all the time:

C:\HPBSM\opr\bin>RestWsUtil.bat -c new_event.xml -u montest1 -pw "password" -url http://ee-bsm9gw.corp/opr-console/rest/9.10/event_list -v
ERROR:  URL:
        montest1
        For more information you can open the URL in your local browser.

new_event.xml sample was taken from the official guide:

<event xmlns="http://www.hp.com/2009/software/opr/data_model">
   <title>Test Event</title>
   <severity>critical</severity>
   <priority>low</priority>
   <state>open</state>
</event>

What actually does such error mean? Is there any log file to be checked?

Thanks!