Oops, I sent this message from the wrong email address, so the list bounced
it.
-David
---------- Forwarded Message ----------
Date: Friday, November 12, 2004 8:19 AM -0500
From: David M Nolan <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Re: Generating mon trap for use as heartbeat
On Thu, 11 Nov 2004, Michael Vogt wrote:
David,
That would be great if you try it and post the results.
Also, thanks to Ed for the montrap script and Kastus for pointing out
the mon.monitor. I did not see the mon.monitor and it looks like it
would detect some problems that the heartbeat does not.
Cheers,
Michael Vogt
The script I wrote is attached. The config blocks on my servers look like
this:
One the server where I want to generate the trap:
watch mon-services-slave
service mon-heartbeat-generator
description Generate Mon Traps to a remote Mon system, to prove
that this Mon system is queuing processes interval 1m
monitor mon-trap.monitor --group mon-services-slave --service
mon-heartbeat-trap hostname-of-destination-server-here ;;
On the server where I want to receive the trap and timeout if I stop
receiving traps:
watch mon-services-slave
service mon-heartbeat-trap
description Receive Mon Traps from a remote Mon system, to verify
the remote system is queuing processes traptimeout 5m
period Mail_Log: wd{1-7}
alert mail.alert logging-address-here
upalert mail.alert logging-address-here
alertafter 2
alertevery 6h
<other period definitions, insert your own as heeded>
So far it seems to be working as expected.
-David
David Nolan <*> [EMAIL PROTECTED]
curses: May you be forced to grep the termcap of an unclean yacc while
a herd of rogue emacs fsck your troff and vgrind your pathalias!
---------- End Forwarded Message ----------
David Nolan <*> [EMAIL PROTECTED]
curses: May you be forced to grep the termcap of an unclean yacc while
a herd of rogue emacs fsck your troff and vgrind your pathalias!
--- Begin Message ---
On Thu, 11 Nov 2004, Michael Vogt wrote:
David,
That would be great if you try it and post the results.
Also, thanks to Ed for the montrap script and Kastus for pointing out
the mon.monitor. I did not see the mon.monitor and it looks like it
would detect some problems that the heartbeat does not.
Cheers,
Michael Vogt
The script I wrote is attached. The config blocks on my servers look
like this:
One the server where I want to generate the trap:
watch mon-services-slave
service mon-heartbeat-generator
description Generate Mon Traps to a remote Mon system, to prove
that this Mon system is queuing processes
interval 1m
monitor mon-trap.monitor --group mon-services-slave --service
mon-heartbeat-trap hostname-of-destination-server-here ;;
On the server where I want to receive the trap and timeout if I stop
receiving traps:
watch mon-services-slave
service mon-heartbeat-trap
description Receive Mon Traps from a remote Mon system, to verify
the remote system is queuing processes
traptimeout 5m
period Mail_Log: wd{1-7}
alert mail.alert logging-address-here
upalert mail.alert logging-address-here
alertafter 2
alertevery 6h
<other period definitions, insert your own as heeded>
So far it seems to be working as expected.
-David
David Nolan <*> [EMAIL PROTECTED]
curses: May you be forced to grep the termcap of an unclean yacc while
a herd of rogue emacs fsck your troff and vgrind your pathalias!
#!/usr/bin/perl
#
#
# Simple script to send a trap to a mon server
#
# David Nolan, [EMAIL PROTECTED]
#
# $Id: mon-trap.monitor,v 1.1 2004/11/11 22:08:35 vitroth Exp $
#
# Copyright (C) 2004 Carnegie Mellon University
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
use Getopt::Long;
use Mon::Client;
$result = GetOptions ( "group=s" => \$group,
"service=s" => \$service,
"monport=i" => \$port,
"user=s" => \$user,
"pass=s" => \$pass,
);
if (!$result || !$group || !$service || [EMAIL PROTECTED]) {
print <<ENDUSAGE;
Usage: montrap --group hostgroupname
--service servicename
[--monport tcpport]
[--user username]
[--pass password]
server-hostname ...
ENDUSAGE
exit 1;
}
$port ||= 2583;
$user = '' if (!defined $user);
$pass = '' if (!defined $pass);
foreach $server (@ARGV) {
$error = 0;
$OPST = 'ok';
$summary = "Test Trap";
$detail = "Test trap to verify mon functionality";
$t = time;
$c = new Mon::Client (
host => $server,
port => $port,
);
if ($user ne "") {
$c->username($user);
if ($pass ne "") {
$c->password($pass);
}
}
$res = $c->send_trap( group => $group,
service => $service,
retval => $error,
opstatus => $OPST,
summary => $summary,
detail => $detail,
);
if (!$res) {
$failures{$server} = $c->error();
}
}
if (keys %failures) {
print join(' ',sort(keys(%failures)));
print "\n";
foreach (sort(keys(%failures))) {
print $failures{$_} . "\n";
}
exit 1;
}
exit 0;
--- End Message ---
_______________________________________________
mon mailing list
[EMAIL PROTECTED]
http://linux.kernel.org/mailman/listinfo/mon