The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Openview::Message::Sender - OO interface to sending HP OpenView messages.

SYNOPSIS

   use Openview::Message::Sender; 
   my $ovs = new Openview::Message::Sender { application=>'name'
                             ,object=>'name'
                             ,text=>'msg_text"
                             ,group=>'msg_group'
                             ,host=>$ENV{'HOSTNAME'} 
                            };
   #take defaults from attributes of $ovs :
   $ovs->send( "your message text" ); 
   #or
   $ovs->send( text=>"your message text" ); 
 
   #providing call specific argments overriding the 
   #some of the defaults provided by the attributes of $ovs :
   $ovs->send( text=>"your message text" 
                   ,severity=>'minor' 
                   ,group=>'MsgGroup' [... etc]  );

DESCRIPTION

Openview::Message::opcmsg provides low level access to the HP Openview operations opcmsg() library API. This enables perl scripts to send Openview messages without having to use system() calls or fork sub-process processes. (i.e. it is much more efficient than the opcmsg command).

Openview::Message::Sender also provides an OO interface, which maintains default values for most of the the arguments to opcmsg(). The defaults are provided at the time the object is constructed. This provides for considerable for less code clutter, and no polution of your namespace.

EXPORTS

Nothing is exported by default.

METHODS (OO Interface)

The OO interface provides the following methods:

new()

Called off the Package. The constructor returns a blessed instance of an Openview::Message object. This method takes a objection argument which is a hash reference of default values which will be used to call opcmsg().

See Attributes for a definition of the attributes recognized.

send()

Sends an Openview opcmsg() using arguments either taken from the hash provided to the call to SendMessage, or from the attributes of the Openview object.

See Attributes for a definition of the attributes recognized.

ATTRIBUTES (OO Interface)

application

This attribute is used for the opcmsg 'application' argument. This attribute defaults to the string 'application not provided'.

object

This attribute is used for the opcmsg 'object' argument.

This attribute defaults to string 'object not provided'.

severity

This attribute is used for the opcmsg 'severity' argument. The values this takes are lowercase strings which are internally mapped to the Openview severity constants prefixed with 'Openview_SEV_'. As in:

   unknown
   unchanged
   none
   normal
   warning
   minor
   major
   critical

This attribute defaults to 'unknown' (OPC_SEV_UNKNOWN).

If one wants to use the OPC_SEC_* constants they can be imported into your name space if desired, and may be slightly more efficient.

text

This attribute is used for the opcmsg 'msg_text' argument. This attribute defaults to the string 'text not provided'.

group

This attribute is used for the opcmsg 'group not provided' argument. This attribute defaults to the string 'undefined'.

host

This attribute is used for the opcmsg hostname argument. It defaults to the value of the HOSTNAME environment variable or "host not provided".

AUTHOR

Lincoln A. Baxter <lbaxter@netreach.net>