IT Operations Management (ITOM)
Showing results for 
Search instead for 
Do you mean 

Meet the OMi Management Pack DevKit, Part 2

Ops_Guest on ‎05-07-2015 01:11 PM

Guest post by Norbert Andres, Ops Bridge, Software Architect

 

HP recently released a development kit for creating Management Packs for Operations Manager i (OMi) operations management software.

In this blog post, I will demonstrate how the DevKit can be used to send events and create graph mappings for the example that got explained in the first blog here. If you haven’t read the first part yet, please consider doing that now.

 

In the first part we created a script to parse an Apache access.log file and store the metric in the agent performance store.

Now we want to optionally send an event in case the log file doesn’t exist, and that is what I will focus on in this post.

To achieve this we first introduce a setting in the ApacheAccessLogCollector.yml file.

 

application: ApacheLogReader
domain: WebServer
description: Reads metrics from apache log files
script: ApacheAccessLogCollector.pm
generate_availability: false
generate_discovery: false
---
logfile: /var/log/apache2/access.log
send_event: yes
---
# logfile: string, Path to access.log, Enter the complete path to the apache access.log file.
# send_event: yes|no, Send event, Send an event in case the log file doesn't exist

In the comment we set the values that Monitoring Automation (MA) will display for this parameter. ‘send_event’ is the key, ‘yes|no’ means that only these two values can be entered for this parameter. Next comes the display label and then the description. You can make this parameter optional by appending [optional] at the end of the comment. Here we leave it as a mandatory parameter with the default set to “yes”.

 

From the code we can access this new parameter like this:

my $sendEvent = $config->[1]->{send_event};

Now we can add the (overdue) check whether the log file provided as a parameter actually exists:

if (!-e $logFile)
  {
    if ($sendEvent eq "yes")
    {
      my %event = ('severity' => 'Warning', 
'text' => 'The logfile "'.$logFile.'" doesn\'t exist');
      $self->event(%event);
    }
    $self->log($self->INFO, "The log file '$logFile' doesn't exist");

    return;
  }

If the log file doesn’t exist, the minimum to do is write a log statement for troubleshooting purposes. If the parameter “Send Event” is set to “yes”, we create an event. Severity is set to warning.

 

Now with this code change we can quickly run a test on the command line.

perl monitorframework.pl ApacheAccessLogCollector.pm

After manipulating the log file name I get this result:

Running ApacheAccessLogCollector for metric/event collection.
  Event:
    Severity:    Warning
    Text:        The logfile "access.loglog" doesn't exist
    Node:
    Time:        2015-3-27 14:21
    Application: ApacheLogReader
    Category
    CiInfo:
    LogOnly:     false
    State:       open
The log file 'access.loglog' doesn't exist

So the logic seems to work. Let’s compile a Management Pack and try on a real agent using OMi 10.

Since we already created a previous version (remember you got to keep the content of the “config” directory), we create a version 1.2 using this command:

ContentCreator[.bat|.sh] –yml ApacheAccessLogCollector.yml –major 1 –minor 2

We now upload the Management Pack using the Content Manager of OMi and then deploy the MP as seen on the screenshot:

 

Shortly after deployment (and again after some manipulations to the log file name) the event shows up in Omi in a single pane of glass:

The event has successfully arrived.

If we now remember a state that we just sent an event we could send a “normal” event in case the log file suddenly appears. Since the message key is already set, the only thing we need to do is to send an event with the severity “Normal” (plus a different message text) to close the previous event.

In our case this is sufficient because we have only one event we would send.

If you send different type of events, you need to specify a specific message key. You can do this in the event data, by adding “option_msgkey” => ”ApacheLogReader:ApacheLogReader:filemissing’”.

my %event = ('severity' => 'Warning', 
‘option_msgkey’ => ‘ApacheLogReader:ApacheLogReader:filemissing’
'text' => 'The logfile "'.$logFile.'" doesn\'t exist');
      $self->event(%event);

If you have instance based monitoring, e.g. you want to monitor more than one instance of a log file or disk drives, URLs… you can add an instance identifier to the event:

my %event = ('severity' => 'Major', 
‘text' => Redis on port 6379 is no longer running', 
'category' => ‘Redis’, 
'instance' => ‘redis_ 6379’);
$self->event(%event);

The event will then show up at redis_6369@@<node> if such a CI exists.

 

To send a closed event in case an error doesn’t occur anymore, you can simply at “state” => “closed”:

my %event = ('severity' => ‘Normal', 
		‘state’ => ‘closed’,
'text'  => 'The logfile "'.$logFile.'" now exists');
      $self->event(%event);

In this case, this event would close events with the same message key and move directly to the closed events section

 

Custom CI Hint:

my %event = ('severity' => 'Major', 
‘text' => 'Failed to contact access point: '.$url.', 
‘related_ci_hint’ => ‘myapplicationsrv1@@’.$nodeFqdn,
'category' => “my category”);
$self->event(%event);

While this requires a good understanding of the way CI hints work it gives you a very fine granular way of influencing for which CI this event will appear.

The default would be the node or <instance>@@<node>. “instance” can in this case also be a CI type. So when you have a software than can run only once on a system and you want the event to appear for this CI, you can specify hadoop_master@@<fqdn>. If the application is instance based the instance identifier would be preferred.

 

So, to sum it up: sending an event using the DevKit is a matter of a few lines.

For more information check out the guide on the HP Live Network here.

 

In the next blog, we will look into graphs and checking thresholds based on metrics.

 

News:

 

HP Discover Las Vegas 2015 is just around the corner, starting June 2nd. We have many announcements, sessions, demonstration booths for you to see and learn about our new exciting innovations. Register early to avoid disappointment. Here is a list of our HP OpsBridge related sessions that you won’t want to miss:

 

Session #

Title

Date / Time

Speakers

V3739

Vivit Opsbridge Deep Dive Session

Monday 1st June
1.00 – 3.00 PM

Carol Park
Ken Herold

Ian Bromehead

RT1250

IT Transformation best practices, how evolving to the OpsBridge brings value

Tuesday, June 02, 2015

12:30 PM-01:30 PM

Mike Davies

Andy Wilkes

Miron Mizrahi

Ian Bromehead

 

RT1251

Identifying the power and differentiation of a business value dashboard

Wednesday 3rd June

4.30-5.30PM

Luke Bradley Andreas Grollich, Vodafone Group
Harald Burose, Miron Mizrahi, HP

DT952

See how the all new OpsBridge Business Value Dashboard turns IT data into business insight

Tuesday, June 02, 2015
04:30 PM-05:00 PM

 

Luke Bradley and Andreas Grollich of Vodafone Ireland

Harald Burose, HP

B827

Announcing HP Operations Bridge v10, case studies of Vancity and Arizona Public Services

Wednesday, June 03, 2015

09:30 AM-10:30 AM

 

Jay Rooney, Vancity

Ben Clonts, Arizona Public Sector

Ian Bromehead, HP

DF833

How IT Event Management with analytics inside can help you dramatically improve efficiency

Thursday, June 04, 2015

01:30 PM-02:00 PM

 

Harald Burose, HP

Ian Bromehead, HP

B814

Evolving from domain to service-driven operations to dramatically improve operational efficiency

Wednesday 3rd June
12.30-1.30PM

Luke Bradley | Andreas Grollich | of Vodafone Group
William Gillen | Richa Trivedi of Fidelity Investments

B614

Innovations in the Operations Agent are helping customers improve operations efficiency

 

Sanjay Chaudhary, HP David Herbstman, Wells Fargo, Kevin Hoffman, Costco

B790

Maximize cloud and application performance with hundreds of operations bridge integrations

Thursday 4th June
3-4PM

Idan Harel, DoitWise, Rene Soltis, Citrix, Stefan Bergstein, HP

DT1080

Proving value to executive management, Verizon Wireless on IT Operations Monitoring and Automation

Thursday 4th June

2.30-3.00PM

Andy Wilkes, HP
Anthony Gibson, Verizon Wireless

RT1280

Best practices for cloud monitoring with BSM

Thursday 4th June

9-10 AM

Idan Harel, Doitwise
Stefan Bergstein, HP

B1247

What’s new in BSM, innovation tour and demonstrations

Tuesday 2nd June 12.30-13.30 PM

Christoph Pfister

Jeff Scheaffer

Joe Fox, HP

 

Search on the tag OMiContent for more blogs similar to this one.

 

The OM2Opsbridge program including license exchange details is now live.

Search on the tag OM2OpsB to find blogs discussing this program and evolution to OpsBridge.

 

We are pleased to announce the HP BSM Integration for BMC Impact Manager by Comtrade, version 1.1. The HP BSM Integration for BMC Impact Manager by Comtrade enables you to establish a link between BMC Impact Manager and HP Operations Manager i 10 (OMi).  

 

The key features of this release are:    

  • Support of Operations Manager i 10 and BSM Connector 10    
  • Self-discovery  

The installation package and the integration guide are available at http://www.comtrade.com/bmc-integration/

 

We are also pleased to announce the availability of yet another extension to our fast growing catalogue of management tools, the lightweight OMi Management Pack for Docker has been released on HP-LN:

 

https://hpln.hp.com/contentoffering/omi-management-pack-docker

 

0 Kudos
About the Author

Ops_Guest

Events
June 6 - 8, 2017
Las Vegas, Nevada
Discover 2017 Las Vegas
Join us for HPE Discover 2017 in Las Vegas. The event will be held at the Venetian | Palazzo from June 6-8, 2017.
Read more
Apr 18, 2017
Houston, TX
HPE Tech Days - 2017
Follow a group of tech bloggers for a new HPE Tech Day, a full day of sessions about how to create a hybrid IT, from hyperconverged to Composable Infr...
Read more
View all
//Add this to "OnDomLoad" event