I followed the suggestion of writing a traphandler for snmptrapd to
send a mon trap. Here is the script:
#!/usr/bin/perl
use Mon::Client;
$mon = new Mon::Client(
host => "localhost",
port => 2583,
username => "mon",
password => "secret"
);
chomp($hostname = <>);
chomp($ipaddr = <>);
$detail = "";
while (<>) { $detail .= $_; }
$mon->send_trap(
group => "snmp",
service => "trap",
retval => 1,
opstatus => "unknown",
summary => "SNMP trap from $hostname",
detail => $detail
);
Maybe I'm doing something wrong, because I see this in the logs but no
alert is ever sent:
Apr 8 16:44:51 gwythaint mon[19720]: trap trap 5 from 127.0.0.1 for
snmp trap, status 1
Apr 8 16:44:51 gwythaint mon[19720]: trap received from 127.0.0.1 for
undefined type trap 5 snmp
Here's the relevant config bit:
watch default
service default
description Default trap service
period
alert mail.alert fugalh
--
De gustibus non disputandum est.
_______________________________________________
mon mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/mon