IT Operations Management (ITOM)
cancel

Easier event handling for Operations Manager i

Easier event handling for Operations Manager i

Harald

As we all know that Operations Manager i offers a powerful web-based user interface. It is targeted for both operators and administrators.

 

All Operations Manager i tasks - like viewing events / dashboards, running corrective actions, opening a ticket – can be done. Nevertheless I personally like command line tools, too. It’s not an “either or preference”, but it depends on what you would like to achieve. For example, with CLIs scripting, and automation can be achieved pretty fast.

 

In this blog, I will highlight some cool command line tools related for event handling for the Operations Manager i –versions 9.2x and 10. I am pretty sure you also find some interesting use cases for your setup within this blog.

 

Operations Manager i Command Line Tools you should know: Event handling

 

Operations Manager i comes with a powerful user interface. All operational tasks as well as administrative tasks – e.g. deploying instrumentation, configuration of monitoring stations, tuning and setting up user rights – can be achieved.

 

So no need for command line tools? Not really, sometimes it is very convenient to have command line tools available. Not only for small tasks - like getting dedicated information quickly from the Operations Manager i system, but also to perform tasks on a regular basis or even on multiple OMi instances in parallel.

Think of tasks you do on a regular basis and where you would need several clicks in the OMi UI. Scripting these steps allows powerful operations—which can be executed quickly, is repeatable, in an automated fashion—and last but not least user-error free, since no user interaction is needed.

 

In this blog, I will highlight some OMi event handling command line tools, which I use on a regular basis and which might also be useful for you.

 

You can download Operations Manager i here to try these command line tool for yourself.

 

Sending Events

The first command line tool in my list is very useful for testing the event flow. It allows you to create an event with specific attributes. The tool can be executed directly on the Operations Manager i system and does not need any other application installed and configured—this is very beneficial. Instead of creating an OM agent policy and deploying it to a managed node, you can just use this tool.

 

The tool is called sendEvent. It is located in <HPBSM>/opr/support directory on the Operations Manager i Gateway System.

 

To send a test event simply execute:

sendEvent.sh -t Test -s normal

 

This will send one event with title "Test" and severity "normal" to the Operations Manager System i. As output you will get the following confirmation message:

1 events sent

 

In addition, you will see the event in the OMi Event Browser.

 

But what if you want to simulate the creation of an event from a different server than the Operations Manager i?

 

For this utilize the sendEvent tool has a node-switch "-nd" option:

sendEvent.sh -t Test -s normal -nd harald.example.com

 

The above sends an event with title "Test", severity "normal" and node "harald.example.com". It simulates that the event was created from a different server than we have executed the tool.

 

Now let us simulate an event with a specific Event Type Indicator. Event Type Indicators are used to set status information for Configuration Items (e.g. the status for a node or a database server). The corresponding parameter is "-eh". The following sample sets the status for node "harald.example.com" to "Down":

sendEvent.sh -t "Node is down" -s critical -nd harald.example.com -eh NodeStatus:Down

 

The result is immediately visible in the Operations Manager i dashboard. The node status is critical:

 

 

In order to bring the node back in a good state, I simply send another event with status "Up" and severity normal:

sendEvent.sh -t "Node is down" -s normal -nd harald.example.com -eh NodeStatus:Up

 

 

To see all available options for the sendEvent tool you can use the –h for the help:

sendEvent.sh –h

 

Export and Import of Events

The next set of command line tools can be used to export and import events. Also, if you want to record & replay certain event scenarios this might be interesting for you.

 

Let us start with exporting events.

/opt/HP/BSM/opr/support/opr-export-events.sh

 

To export all events from the OMi database, just call the following:

opr-export-events.sh -server <OMi-Server> -all -o <filename> -username <username> -password <password>

 

In case there are lots of events in the database, it might be better to restrict the events using the query option.

-q watermark=2015-02-10T00:00:00Z

 

This will export only events received or updated after 2015-02-10 (February 10, 2015). This export includes currently active as well as closed events.

 

The file <filename> contains the exported events in a specific format, which you shouldn’t change. You can archive the file and/or use it for reload and even for an event replay which I will show next steps.

 

The command line tool for this is: /opt/HP/BSM/opr/support/opr-import-events.sh

 

The import or restore of event use the following syntax:

opr-import-events.sh -i <filename>

 

This restores the exported events directly into the Operations Manager i database.

 

Alternatively you can also re-submit/replay the previously exported events. This does a complete resubmit using the Operations Manager i event pipeline. It therefore simulates that the event source is sending it again. This is a cool feature especially for testing Operations Manager i scripting and automation use cases.


You replay the events using the "-r" option. In addition any already existing event in the Operations Manager i database can be deleted before using the "-clear" parameter:

opr-import-events.sh -i <filename> -r -clear

 

The great thing is that the tool also knows the time gap between every event. That means events will be sent to the Operations Manager i Event Pipeline using the same time delay that they originally arrived in. This allows us to simulate real-time scenarios.

 

This time gap can tailored by using the "-tf" time_factor parameter. No parameter or factor "1" means real time, a value of "100" divides time by 100 – meaning 100 times faster as originally received. A factor of "0" means no delay – meaning all events will be resubmitted with maximum processing speed.

 

This time_factor option enables you to simulate many different event scenarios—including load testing. Operations Manager i server scripts—e.g. used for event enrichment, call outs, Stream-Based-Event-Correlation (SBEC) rules—can be fine-tuned in your test environment before you introduce new/changed processing steps in your production environment.

 

Archiving of events

All events which are in a closed state can be removed from the event database. This is useful to keep the consumed database size small, to allow faster event processing, and to have regular backups of closed events.

 

The command line tool is:

/opt/HP/BSM/bin/opr-archive-events.sh

 

In order to archive all closed events older than a specific date, you can use the archive option

opr-archive-events.sh -a -u 2015.02.16 -o /tmp/events.xml

INFO: Number of archived events: 42

INFO: Archived all events received before 2/16/15 12:00:00 AM. (42 events affected)

 

It is also possible to just delete closed events using the delete option:

/opt/HP/BSM/bin/opr-archive-events.sh -d -u 2015.02.16

INFO: Number of deleted events: 27

INFO: Deleted all closed events received before 2/16/15 12:00:00 AM on user request. (27 events affected.)

 

The parameter "-force" disables the security question and makes the tool ready for automation.

 

Event Statistics

My tool of choice to get Operations Manager i event statistics is the EventStatisticsUtil tool. It displays all kind of status information according to the events loaded into the Operations Manager i database.

/opt/HP/BSM/opr/support/EventStatisticsUtil.sh –l

 

 

 

Summary:

I hope this selection of event related command line tools was useful to you and will help you to speed up your Operations Manager i automation and time-to-value. Feel free to share your examples, leave a comment and share your thoughts about it.

 

 

 

 

You can download Operations Manager i here to try these command line tool for yourself.

 

 

 

  • operations bridge
0 Kudos
About the Author

Harald

Comments
Honored Contributor.

Hello Harald,

 

thanks for the interesting post. I have just a question about opr-import-events because is not completely clear for me.
When you refer to "-r" and "-clear" options that resubmit the event to the whole event pipeline do you mean that the message is considered as a new one, so Health Indicator status, severity and others are set again ?

 

Because I'm considering to use those tools to set the status for an APM environemt from start.

 

Kind regards,

Regular Contributor.

Hello,


thanks for these tips but now I have few questions.


I tried to export event but i must stopped the batch after 1h30 of execute and a file of 600 mo... I looked the file and I obtained events for less a day. If my goal is obtain closed event with at least the title, there are options for filter events?


I also executed the command for stat and I obtain these stats :


active_events: 4155
active_history_lines: 304
active_history_lines_property_changes: 316
active_custom_attributes: 9201
active_forwarding_infos: 2767
active_annotations: 292
closed_events: 1502054
closed_history_lines: 1312368
closed_history_lines_property_changes: 1321824
closed_custom_attributes: 3003487
closed_forwarding_infos: 724896
closed_annotations: 151449
event_sync_buffer_entries: 0


Should I use archive command ?


If I use this command, I must be aware about something ?

N/A

Hello Harald,

Using opr-export-events.bat can we export events between two dates?

HPE Blogger

Hello kverma,

the CLI supports the -q query option. But I think you can only export from a specific date to 'now'...

Kind regards,
Harald