3 # Notification Script used by OMD
16 my $mail = $ENV{'OMD_ROOT'}.'/bin/mail -t';
20 'option|o=s' => \
%macro,
22 'template=s' => \
$template,
24 'verbose' => \
$verbose,
27 if ( $template eq '' ){
28 print "Template not given\n";
32 if ( ! -e
$template ){
33 print "Template \"$template\" not found\n";
37 map($macro{$_} =~ s/\\n/\n/gmx, keys %macro);
38 extract_ascii
($macro{'LONGHOSTOUTPUT'});
39 extract_ascii
($macro{'LONGSERVICEOUTPUT'});
43 sub process_template
{
44 open FILE
, $template or die "Couldn't open file: $!";
51 my $template = Template
->new({PRE_CHOMP
=> 1, POST_CHOMP
=> 0, EVAL_PERL
=> 1});
52 $template->process(\
$data, \
%macro, \
$output) or die Template
->error;
53 print $output if $verbose;
58 open (MAIL
,"|$mail $macro{'CONTACTEMAIL'}") || die("Couldn't open $mail: $!");
66 $0 --template=<path to template> -o <MACRO>=<VALUE> -o ....
72 return unless defined $_[0];
74 ^ASCII_NOTIFICATION_START
$
76 ASCII_NOTIFICATION_END
$