
__END__

=head1 NAME

Health.pm - Parent of all /Health modules, provide event functions.


=head1 SYNOPSIS

 use Health;

 $hm->discoveryEvent();
 $hm->connectionEvent();
 $hm->removeCompEvent();
 $hm->insertCompEvent();

 $hm->stateEvent();
 $hm->sevStateEvent();  # Sun Solution (se,se2) only
 $hm->mapChangeEvent();
 $hm->changeEvent();
 $hm->logEvent();

 $hm->portStatEvents();
 $hm->fcEvent();
 $hm->fcRemoteEvent();
 $hm->processFC();
 $hm->linkEvent();

 $hm->thresholdEvent();
 $hm->tempEvent();
 $hm->locationChangeEvent();

 $hm->diagEvent();
 $hm->identificationEvent();
 $hm->statisticEvent();



=head1 DESCRIPTION

This module provide event generation functions to the Health modules
in Health/*.pm


=head1 METHODS

=over 4

=item $hm->discoverEvent($report, $CIM_package_name, $audit_flag)

Create and return a  discovery event using these paramaters:

  $report          : Report : Instrumentation Report.
  $CIM_package_name: string : 'NWS::T3', 'NWS::Brocade', etc..
  $audit_flag      : integer: 1 if this is an audit event, 0 otherwise.
  
  $ed              : Message: Event Message.
   
An event message (Message.pm) is composed of a header and an Instance List (Ilist.pm).


=item $hm->connectionEvent($key, $report, {method => 1|2|3});

Create a CommunicationLost or CommunicationRegained Event 

  $key    : string : key of the device.
  $report : Report : Instrumentation Report.
  $method : integer: 1=inband, 2=outOfBand, 3=Both
            
This event relies of the current status of the report to generate the appropriate
events. It remembers the last status of the report and can generate transition
from normal => comm-lost and the reverse. 

  Return values:
     1: communication is lost or was already lost.
     0: communication is regained or was already working.

The method is used to create a more specific event description using the words
'inband' and 'outofband'.  Whith method=3, the report values 'info.IB_host' and 'info.IB_status'
are used for inband information (used only on t3s so far).

Health agents are usually written with:

  return if ($hm->connectionEvent());
  to avoid running the rest of the health module when communication is lost.


=item $hm->removeComponentEvent($comp, $physical_frame_key, $report, $orep, $CIM_type, $fru_key, $device_key, $extra_args);

Remove a component (usually fru) from a device.
                                


=back 2
=cut
   




