[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mon
Subject:    A quick guide to traps and Mon (was: Asynchronous Events)
From:       Ed Ravin <eravin () panix ! com>
Date:       2001-08-07 16:22:49
[Download RAW message or body]

Kevin Handy writes:
> > Check the mon list archives and search for "traps" - that's the feature
> > you want.  This feature is still in development, but it can be made
> > to work.
> 
> I've looked at the archive, and all I could spot was messages saying
> it existed

Oh well, perhaps it's harder to find than I thought.  Here's a couple of
quick tips:


Mon::Client supports sending traps to the mon server.  See the "send_trap"
routine.  "perldoc Mon::Client" should show you the documentation.

Mon almost supports receiving the traps - there are a few rough edges
around the interface.   I had to patch the Mon server slightly to get
it to do what I wanted (accept traps from localhost and only from
localhost).  If you're not comfortable with minor Perl debugging,
you might not want to proceed any farther.

To see how the features are supposed to work, do "man mon" and look
for the word "trap" in various places, especially the description
of the "trapbind", "trapport", "traptimeout" and "trapduration"
keywords.

Here's an example from my mon.cf of a service that sends "heartbeat"
traps.  If the traps stop, Mon will consider the service down after
5 minutes.  When a trap arrives, the service is considered up after
1 second.

   watch frankenstein
           service paging
                   description is the monster still alive?
                   traptimeout 5m
                   trapduration 1s


Here's my patch to get mon to not fail on startup when using a wildcard
for "traphost".  My reasoning is that since UDP is so easily forged,
this isn't much security anyway (that's why there's a password, I suppose),
so I get security by only allowing traps from the local system
(trapbind=127.0.0.1)

@@ -3320,7 +3318,7 @@
                syslog ('err', "invalid host in $CF{AUTHFILE}, line $.");
                next;
            }
-           $host = inet_ntoa ($host) unless $host eq "*";  ## elr
+           $host = inet_ntoa ($host);
            $AUTHTRAPS{$host}{$user} = $password;

        } elsif ($sect eq "snmptrap") {


-----------------------

Anyway, this should be enough to get you started!

	-- Ed

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic