Hi all !

I'm using MON for monitoring an Heartbeat cluster and it seems to work quite well !
But I've a problem with a personal alert. I did a Perl script 'ha-mail.alert' which has to send mail when cluster die.
If I try to run manually my script, it perfectly works. I can use switches to change message, subject, ...
But when I try to use it with MON, it's impossible to use switches. MON debug is :


select returned 1 file handles
[www.google.fr
1110970252 10.0.0.232:3128 www.google.fr / 66 -1.000
] from FileHandle=GLOB(0x8276eb4)
EOF on FileHandle=GLOB(0x8276eb4)
PID 23365 (squidgrp/http) exited with [1]
reaped non-monitor, pid 634 status 0
reaped non-monitor, pid 23371 status 0
Unknown option: s
2005/03/16_11:50:53 Going standby [all]


The problem is with "s" option, but I really don't know from where it is coming !!!


My mon.cf is :
----------------------------
hostgroup squidgrp [EMAIL PROTECTED]:3128
watch squidgrp
        service http
                interval 5s
                monitor http_tp.monitor
                period wd {Mon-Sun}
                        alert ha-mail.alert -f `uname -n` -t "[EMAIL PROTECTED]"
                        alert ha-standby.alert
                        upalert ha-mail.alert -u -f `uname -n` -t "[EMAIL 
PROTECTED]"
                        upalert ha-takeover.alert
                        alertevery 1h
-----------------------------

And my ha-mail.alert script is :
-----------------------------
#!/usr/bin/perl

use Net::SMTP;
use Getopt::Std;

getopts("f:t:S:u");
if(defined $opt_u){
        $msg = "Server Up !";
        $subj = "Server Up";
}
else{
        $msg = "Server Down !";
        $subj = "Server Down";
}

$server_name = "mysmtp";
$smtp = Net::SMTP->new($server_name);

if(defined $opt_f){ $mail_from = $opt_f }
else { $mail_from = "Server" }

if(defined $opt_t){ $mail_to = $opt_t }
else { $mail_to = "[EMAIL PROTECTED]" }

if(defined $opt_S){ $mail_subject = $opt_S}
else { $mail_subject = $subj }

$smtp->mail($mail_from);
$smtp->recipient($mail_to);
$smtp->data();
$smtp->datasend("To: " . $mail_to . "\n");
$smtp->datasend("From: " . $mail_from . "\n");
$smtp->datasend("Subject: " . $mail_subject . "\n");
$smtp->datasend("\n");
$smtp->datasend($msg . "\n");
$smtp->dataend();
$smtp->quit();
-----------------------------

Any help will be appreciated ! Thanks :)
--
Alexis

_______________________________________________
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon

Reply via email to