summaryrefslogtreecommitdiff
path: root/usr.sbin/relayd/hce.c
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2008-02-11 10:42:51 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2008-02-11 10:42:51 +0000
commit4f77a014e2652c1f57fecbf8248f1a508abc1800 (patch)
treec344635d365c0ef49b2a71130ee33183e8d1fa4d /usr.sbin/relayd/hce.c
parent243d83e4c9a82ad7657baf88346a66f65293b8b0 (diff)
Marry relayd with snmpd using new "send trap" option: Request to send
a SNMP trap when the state of a host changes. relayd(8) will try to (re-)connect to snmpd(8) and request it to send a trap to the registered trap receivers, see snmpd.conf(5) for more information about the configuration. ok pyr@ thib@
Diffstat (limited to 'usr.sbin/relayd/hce.c')
-rw-r--r--usr.sbin/relayd/hce.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.sbin/relayd/hce.c b/usr.sbin/relayd/hce.c
index 2aad94c9eba..7b51281bfe3 100644
--- a/usr.sbin/relayd/hce.c
+++ b/usr.sbin/relayd/hce.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hce.c,v 1.39 2008/01/31 09:33:39 reyk Exp $ */
+/* $OpenBSD: hce.c,v 1.40 2008/02/11 10:42:50 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -167,6 +167,8 @@ hce_setup_events(void)
struct timeval tv;
struct table *table;
+ snmp_init(env, ibuf_main);
+
if (!TAILQ_EMPTY(env->sc_tables)) {
evtimer_set(&env->sc_ev, hce_launch_checks, env);
bzero(&tv, sizeof(tv));
@@ -322,6 +324,10 @@ hce_notify_done(struct host *host, const char *msg)
host_status(host->last_up), host_status(host->up),
print_availability(host->check_cnt, host->up_cnt));
}
+
+ if (host->last_up != host->up)
+ snmp_hosttrap(table, host);
+
host->last_up = host->up;
}