[hobbit] trouble with SCRIPT directive
Haertig, David F (Dave)
haertig at avaya.com
Sat Jan 5 18:59:49 CET 2008
You could make a dummy shell script named "trapgen_wrapper" that just
hardcodes the ip address parameter and then calls the real trapgen using
that. Reference trapgen_wrapper in your hobbit alert config file,
passing it that same bogus_parameter for the recipient (which is
meaningless for your application, but required by Hobbit syntax).
If you don't want to hardcode the ip address in trapgen_wrapper, you
could make trapgen_wrapper parse out the info from the environment
variable "RCPT".
Here's a similar example I use to kill a process. The SCRIPT directive
in hobbit-alerts.cfg passes this script three parameters, the hostname,
the userid, and a patternmatch for the kill.
SCRIPT kill_script hostname,userid,pattern_to_match
And here's the script that processes the above:
#!/bin/perl
# RCS $Id: kill_script,v 1.3 2007/09/26 15:19:07 hobbit Exp $
#$debug++; # Comment-out this line for normal operation
($host, $id, $pattern) = split(/,/, $ENV{RCPT}, 3);
exit unless ((defined $host) && (defined $id) && (defined $pattern));
$command = qq!ssh $id\@$host "pkill -f '$pattern'"!;
if ($debug) {
$command =~ s/pkill/pgrep -l/;
print `$command`;
}
else {
`$command`;
}
-----Original Message-----
From: Galen Johnson [mailto:Galen.Johnson at sas.com]
Sent: Saturday, January 05, 2008 10:15 AM
To: hobbit at hswn.dk
Subject: RE: [hobbit] trouble with SCRIPT directive
Have you tried putting in a bogus recipient address and your options to
trapgen at the end?
=G=
-----Original Message-----
From: kevin [mailto:khanrahan at charter.net]
Sent: Sat 1/5/2008 11:38 AM
To: hobbit at hswn.dk
Subject: [hobbit] trouble with SCRIPT directive
Hi all,
This might seem long winded but I wanted to describe the problem in
detail and see if anyone could help please.
I am trying to make use of the SCRIPT function in hobbit-alerts.cfg I
am trying to send snmp traps from hobbit to another receiver using a
utility called trapgen and I think the syntax of SCRIPT and trapgen are
getting in each others way.
SCRIPT seems to have this syntax:
SCRIPT <program> <recipient> <options>
And trapgen has this syntax:
trapgen -d destination <options>
So, when I try to assemble it, it has this form:
SCRIPT /home/hobbit/server/ext/trapgen -d 10.10.0.13 <options>
I get an error in the page.log that says trapgen needs at least a
destination specified as:
trapgen -d IPADDRESS ..but it DOES have a destination!!!
It seems that the SCRIPT directive is intercepting the "-d IPADDRESS"
and interpreting it as it's own "recipient" directive.??
Is there a way around this? Is there a way to ignore the "recipient"
directive using SCRIPT?
Thanks for any ideas
KEvin
More information about the Xymon
mailing list