Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

HP OpenView HPOV Event Handler

Rating
1 vote
Favoured:
1
Owner
Hits
101654
Files:
FileDescription
hpov_eventhandler.plhpov_eventhandler.pl
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
This HP OpenView (HPOV) Event Handler takes the output of a Nagios monitoring system and feeds it into HP OpenView. As submitted, requires Monarch or GroundWork Monitor Open Source (both are readily downloadable from SourceForge).
''This HPOV Event Handler takes the output of a Nagios monitoring system and feeds it into HP OpenView.

Additional requirements: these instructions assume Monarch or GroundWork Monitor Open Source is installed (either is readily downloadable from SourceForge). If you come up with a generalized procedure that works with generic Nagios please feel free to inform us and post it as well.

==========================================

The eventhandler will call the Openview command 'opcmsg' which has the following syntax:

/opt/OV/bin/OpC/opcmsg node= application= object= msg_text= severity= msg_grp=

> should be the fully qualified node name (xyz.Company.COM)
> and can be set depending on the type of message to be sent - maybe from the profile or type of check that produced the result
> should be the full text of the message (enclosed in ")
> should be set to GWMP or something unique

To keep these separate, GWMP is a new message group, so it is easy to capture/filter the events on the Openview side..


Definition for Global Host Event Handler
/usr/local/groundwork/nagios/eventhandlers/hpov_eventhandler.pl host $LASTHOSTCHECK$ "$HOSTNAME$" "$HOSTSTATE$" "$HOSTOUTPUT$"

Definition for Global Service Event Handler
/usr/local/groundwork/nagios/eventhandlers/hpov_eventhandler.pl service $LASTSERVICECHECK$ "$HOSTNAME$" "$SERVICESTATE$" "$SERVICEOUTPUT$" "$SERVICEDESC$"


Here are the instructions for installing the hpov event handler. These instructions assume you're using Monarch (downloadable from SourceForge) with Nagios (both Monarch and Nagios are integrated in GroundWork Monitor Open Source, which is also downloadable from SourceForge.)

1. Copy the file hpov_eventhandler.pl to /usr/local/groundwork/nagios/eventhandlers/ on the production system.

2. Define the command to be used for the host global event handler.

1. In Monarch, Commands, add a command with name "hpov_host_eventhandler".
2. The command line should be:

/usr/local/groundwork/nagios/eventhandlers/hpov_eventhandler.pl host $LASTHOSTCHECK$ "$HOSTNAME$" "$HOSTSTATE$" "$HOSTOUTPUT$"

1. The command type should be "other".


2. Define the command to be used for the service global event handler.

1. In Monarch, Commands, add a command with name "hpov_service_eventhandler".

1. The command line should be:

/usr/local/groundwork/nagios/eventhandlers/hpov_eventhandler.pl service $LASTSERVICECHECK$ "$HOSTNAME$" "$SERVICESTATE$" "$SERVICEOUTPUT$" "$SERVICEDESC$"

1. The command type should be "other".


3. Modify Nagios main config to enable the eventhandlers. Make the following changes in Monarch, Control, Nagios.cfg edit:

1. Enable eventhandlers.
2. Set the Global Host Eventhandler to hpov_host_eventhandler. This should be in the dropdown list.
3. Set the Global Service Eventhandler to hpov_service_eventhandler. This should be in the dropdown list.
4. Commit the changes to Nagios.


If you need to debug, you can look at the log file /usr/local/groundwork/nagios/eventhandlers/hpov.log for the opcmsg commands.''
Reviews (1)
bylbtm, December 26, 2011
#!/usr/bin/perl -w
#
# hpov_eventhandler.pl v1.0 - 07/21/2006
#
# HP Openview Event Handler
# Copyright 2006 GroundWork Open Source Solutions, Inc. (“GroundWork”)
# All rights reserved. Use is subject to GroundWork commercial license terms.
#
# Revision History
# 21-Jul-2006 Peter Loh
#
#

use strict;
use Time::Local;
use Time::HiRes;

my $debug = 1;
my $debuglog = ">> /usr/local/nagios/var/hpov.log";
my $hpov_cmd = "/opt/OV/bin/opcmsg";
my ($lastcheck,$host,$service,$status,$statustext);
my $type = $ARGV[0]; # host or service type

$lastcheck = $ARGV[1];
$host = $ARGV[2];
$status = $ARGV[3];
$statustext = $ARGV[4];
$service = $ARGV[5];

my $hpovstatus = undef;

if ($debug) {

open(FP, $debuglog) ;

print FP "---------------------------------------------------------------------\n " ;

print FP `date`." Host: $host\n Svcdesc: $service\n Lastcheck: $lastcheck\n Status: $status\n Statustext: $statustext\n" ;

}


my $cmdstring = $hpov_cmd;

if ($host !~ /\.Cadence\.COM$/i) {

$host .= ".Cadence.COM";

}

$cmdstring .= " node='$host'";

$cmdstring .= " application='gto_gwmon'";

if ($type eq "service") {

$cmdstring .= " object='$service'";

if ($status eq "OK") {

$hpovstatus = "normal";

} elsif ($status eq "WARNING") {

$hpovstatus = "warning";

} elsif ($status eq "CRITICAL") {

$hpovstatus = "critical";

} elsif ($status eq "UNKNOWN") {

$hpovstatus = "minor";

} elsif ($status eq "RECOVERY") {

$hpovstatus = "normal";

} elsif ($status eq "FLAPPING") {

$hpovstatus = "minor";

} else {

$hpovstatus = "minor";

}

} else {

$cmdstring .= " object='HOST_ALERT'";

if ($status eq "UP") {

$hpovstatus = "normal";

} elsif ($status eq "DOWN") {

$hpovstatus = "critical";

} elsif ($status eq "UNREACHABLE") {

$hpovstatus = "major";

} elsif ($status eq "UNKNOWN") {

$hpovstatus = "minor";

} elsif ($status eq "RECOVERY") {

$hpovstatus = "normal";

} elsif ($status eq "FLAPPING") {

$hpovstatus = "unknown";

} else {

$hpovstatus = "minor";

}

}

$cmdstring .= " msg_text=\'$statustext'";

$cmdstring .= " severity='$hpovstatus'";

$cmdstring .= " msg_grp='GWMP'";

my @lines = `$cmdstring`;

if ($debug) {

print FP "Command string = $cmdstring\n " ;

print FP "Command Results = @lines\n" ;

close FP;

}

__END__