Leon wrote:
Hi everyone,

I am created this script to send e-mails (see below). I get this error when I try to run it:

Number found where operator expected at
C:\scriptz\test\NEWSCR~1.CGI line 15, ne
ar "The IP address for the interface that caused the
event, or "0"
  (Might be a runaway multi-line "" string starting on
line 7)
        (Do you need to predeclare The?)
String found where operator expected at
C:\scriptz\test\NEWSCR~1.CGI line 16, ne
ar "The NNM management station ID: $ARGV[9] ""
  (Might be a runaway multi-line "" string starting on
line 15)
        (Missing semicolon on previous line?)
syntax error at C:\scriptz\test\NEWSCR~1.CGI line 15,
near "The IP address for t
he interface that caused the event, or "0"
BEGIN not safe after errors--compilation aborted at
C:\scriptz\test\NEWSCR~1.CGI
 line 20.

This is the script. I think it has something to do
with the "'s but I am not sure where I am going wrong.
 Any help would be great.

Thx,

Leon


#!/usr/local/bin/perl #Send E-mail for Critical Alerts

#Here we define our parameters
$to = '[EMAIL PROTECTED]';
$from = "Openview Server";
$body = "Interface Down:  The ID of application
sending the event is $ARGV[0]
The hostname of the node that caused the event is:
$ARGV[1]
The HP OpenView object identifier of the node that
caused the event is: $ARGV[2]
The HP OpenView object identifier of the node that
caused the event is: $ARGV[3]
The database name is: $ARGV[4]
A time stamp for when the event occurred is: $ARGV[5]
The HP OpenView object identifier of the interface
that caused the event is: $ARGV[6]
The name or label for the interface that caused the
event is: $ARGV[7]
The IP address for the interface that caused the
event, or "0" if unavailable is: $ARGV[8]
The NNM management station ID: $ARGV[9] ";
$subject = "Major Failure segment $ARGV[0] is down";

#Here we use the module pass more specific parameters
    use Net::SMTP;

$smtp = Net::SMTP->new('10.11.1.134');

    $smtp->mail($ENV{USER});
    $smtp->to($to);

    $smtp->data();
    $smtp->datasend("Importance: High\n");
    $smtp->datasend("From: $from\n");
    $smtp->datasend("To: $to\n");
    $smtp->datasend("Subject: $subject\n");
    $smtp->datasend("\n");
        $smtp->datasend("$body");
    $smtp->dataend();

$smtp->quit;


__________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! http://webhosting.yahoo.com/ps/sb/
you have to \" in strings.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to