changes for stats and snmp
This commit is contained in:
parent
f24c18bb4a
commit
cafbf37771
@ -1,5 +1,8 @@
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* enable stats */
|
||||
#undef ENABLE_STATS
|
||||
|
||||
/* enable verify cache */
|
||||
#undef ENABLE_VERIFY_CACHE
|
||||
|
||||
@ -48,6 +51,9 @@
|
||||
/* Define to 1 if you have the `resolv' library (-lresolv). */
|
||||
#undef HAVE_LIBRESOLV
|
||||
|
||||
/* have libsnmp */
|
||||
#undef HAVE_LIBSNMP
|
||||
|
||||
/* Define to 1 if you have the `socket' library (-lsocket). */
|
||||
#undef HAVE_LIBSOCKET
|
||||
|
||||
|
118
smmapdfw/configure
vendored
118
smmapdfw/configure
vendored
@ -1028,6 +1028,7 @@ Optional Features:
|
||||
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
|
||||
--enable-maintainer-mode enable make rules and dependencies not useful
|
||||
(and sometimes confusing) to the casual installer
|
||||
--enable-stats Enables statistics collection. (default=no)
|
||||
--enable-shared[=PKGS]
|
||||
build shared libraries [default=yes]
|
||||
--enable-static[=PKGS]
|
||||
@ -1043,6 +1044,8 @@ Optional Packages:
|
||||
--with-bdb-inc-dir Directory for Berkeley include files
|
||||
--with-djbdns-lib-dir Directory for Bernstein's djbdns library files
|
||||
--with-djbdns-inc-dir Directory for Bernstein's djbdns include files
|
||||
--with-netsnmp-lib-dir Directory for Net-SNMP library files
|
||||
--with-netsnmp-inc-dir Directory for Net-SNMP include files
|
||||
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
|
||||
--with-pic try to use only PIC/non-PIC objects [default=use
|
||||
both]
|
||||
@ -1917,14 +1920,57 @@ if test "${with_djbdns_inc_dir+set}" = set; then
|
||||
|
||||
fi;
|
||||
|
||||
WITHOUT_NETSNMP=0
|
||||
|
||||
# Check whether --with-netsnmp-lib-dir or --without-netsnmp-lib-dir was given.
|
||||
if test "${with_netsnmp_lib_dir+set}" = set; then
|
||||
withval="$with_netsnmp_lib_dir"
|
||||
case "$withval" in
|
||||
no)
|
||||
WITHOUT_NETSNMP=1
|
||||
;;
|
||||
yes)
|
||||
;;
|
||||
*)
|
||||
LDFLAGS="$LDFLAGS -L$withval -R$withval"
|
||||
;;
|
||||
esac
|
||||
|
||||
fi;
|
||||
|
||||
|
||||
# Check whether --with-netsnmp-inc-dir or --without-netsnmp-inc-dir was given.
|
||||
if test "${with_netsnmp_inc_dir+set}" = set; then
|
||||
withval="$with_netsnmp_inc_dir"
|
||||
case "$withval" in
|
||||
no)
|
||||
WITHOUT_NETSNMP=1
|
||||
;;
|
||||
yes)
|
||||
;;
|
||||
*)
|
||||
CPPFLAGS="$CPPFLAGS -I$withval"
|
||||
;;
|
||||
esac
|
||||
|
||||
fi;
|
||||
|
||||
|
||||
ENABLE_VERIFY_CACHE=1
|
||||
|
||||
|
||||
|
||||
|
||||
ENABLE_STATS=0
|
||||
# Check whether --enable-stats or --disable-stats was given.
|
||||
if test "${enable_stats+set}" = set; then
|
||||
enableval="$enable_stats"
|
||||
if test "x$enableval" = xyes; then ENABLE_STATS=1; fi
|
||||
if test "x$enableval" = xno; then ENABLE_STATS=0; fi
|
||||
|
||||
|
||||
fi;
|
||||
|
||||
# Checks for programs.
|
||||
ac_ext=c
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
@ -3449,7 +3495,7 @@ ia64-*-hpux*)
|
||||
;;
|
||||
*-*-irix6*)
|
||||
# Find out which ABI we are using.
|
||||
echo '#line 3452 "configure"' > conftest.$ac_ext
|
||||
echo '#line 3498 "configure"' > conftest.$ac_ext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
(eval $ac_compile) 2>&5
|
||||
ac_status=$?
|
||||
@ -4904,7 +4950,7 @@ fi
|
||||
|
||||
|
||||
# Provide some information about the compiler.
|
||||
echo "$as_me:4907:" \
|
||||
echo "$as_me:4953:" \
|
||||
"checking for Fortran 77 compiler version" >&5
|
||||
ac_compiler=`set X $ac_compile; echo $2`
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
|
||||
@ -5936,11 +5982,11 @@ else
|
||||
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:5939: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:5985: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:5943: \$? = $ac_status" >&5
|
||||
echo "$as_me:5989: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings
|
||||
@ -6169,11 +6215,11 @@ else
|
||||
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:6172: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:6218: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:6176: \$? = $ac_status" >&5
|
||||
echo "$as_me:6222: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings
|
||||
@ -6229,11 +6275,11 @@ else
|
||||
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:6232: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:6278: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:6236: \$? = $ac_status" >&5
|
||||
echo "$as_me:6282: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
@ -8417,7 +8463,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 8420 "configure"
|
||||
#line 8466 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -8515,7 +8561,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 8518 "configure"
|
||||
#line 8564 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -10692,11 +10738,11 @@ else
|
||||
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:10695: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:10741: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:10699: \$? = $ac_status" >&5
|
||||
echo "$as_me:10745: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings
|
||||
@ -10752,11 +10798,11 @@ else
|
||||
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:10755: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:10801: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:10759: \$? = $ac_status" >&5
|
||||
echo "$as_me:10805: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
@ -12121,7 +12167,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 12124 "configure"
|
||||
#line 12170 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -12219,7 +12265,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 12222 "configure"
|
||||
#line 12268 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -13046,11 +13092,11 @@ else
|
||||
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:13049: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:13095: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:13053: \$? = $ac_status" >&5
|
||||
echo "$as_me:13099: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings
|
||||
@ -13106,11 +13152,11 @@ else
|
||||
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:13109: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:13155: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:13113: \$? = $ac_status" >&5
|
||||
echo "$as_me:13159: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
@ -15151,11 +15197,11 @@ else
|
||||
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:15154: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:15200: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:15158: \$? = $ac_status" >&5
|
||||
echo "$as_me:15204: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings
|
||||
@ -15384,11 +15430,11 @@ else
|
||||
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:15387: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:15433: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:15391: \$? = $ac_status" >&5
|
||||
echo "$as_me:15437: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings
|
||||
@ -15444,11 +15490,11 @@ else
|
||||
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:15447: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:15493: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:15451: \$? = $ac_status" >&5
|
||||
echo "$as_me:15497: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
@ -17632,7 +17678,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 17635 "configure"
|
||||
#line 17681 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -17730,7 +17776,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 17733 "configure"
|
||||
#line 17779 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -19361,6 +19407,12 @@ fi
|
||||
|
||||
fi
|
||||
|
||||
if test "x$WITHOUT_NETSNMP" = "x0"; then
|
||||
NETSNMP_LIBS=`net-snmp-config --netsnmp-agent-libs`
|
||||
LIBS="$LIBS $NETSNMP_LIBS"
|
||||
HAVE_LIBSNMP=1
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# Checks for header files.
|
||||
@ -21345,6 +21397,16 @@ cat >>confdefs.h <<_ACEOF
|
||||
_ACEOF
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define ENABLE_STATS ${ENABLE_STATS}
|
||||
_ACEOF
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_LIBSNMP ${HAVE_LIBSNMP}
|
||||
_ACEOF
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -75,6 +75,37 @@ AC_ARG_WITH(djbdns-inc-dir,
|
||||
esac ]
|
||||
)
|
||||
|
||||
WITHOUT_NETSNMP=0
|
||||
AC_ARG_WITH(netsnmp-lib-dir,
|
||||
[AC_HELP_STRING(--with-netsnmp-lib-dir, [
|
||||
Directory for Net-SNMP library files])],
|
||||
[ case "$withval" in
|
||||
no)
|
||||
WITHOUT_NETSNMP=1
|
||||
;;
|
||||
yes)
|
||||
;;
|
||||
*)
|
||||
LDFLAGS="$LDFLAGS -L$withval -R$withval"
|
||||
;;
|
||||
esac ]
|
||||
)
|
||||
|
||||
AC_ARG_WITH(netsnmp-inc-dir,
|
||||
[AC_HELP_STRING(--with-netsnmp-inc-dir, [
|
||||
Directory for Net-SNMP include files])],
|
||||
[ case "$withval" in
|
||||
no)
|
||||
WITHOUT_NETSNMP=1
|
||||
;;
|
||||
yes)
|
||||
;;
|
||||
*)
|
||||
CPPFLAGS="$CPPFLAGS -I$withval"
|
||||
;;
|
||||
esac ]
|
||||
)
|
||||
|
||||
|
||||
ENABLE_VERIFY_CACHE=1
|
||||
dnl AC_ARG_ENABLE(verify-cache,
|
||||
@ -110,7 +141,15 @@ dnl (default=no)])],
|
||||
dnl cyrus_BUILD=libcyrus_worker.la
|
||||
dnl )
|
||||
|
||||
ENABLE_STATS=0
|
||||
AC_ARG_ENABLE(stats,
|
||||
[AC_HELP_STRING(--enable-stats, [
|
||||
Enables statistics collection.
|
||||
(default=no)])],
|
||||
if test "x$enableval" = xyes; then ENABLE_STATS=1; fi
|
||||
if test "x$enableval" = xno; then ENABLE_STATS=0; fi
|
||||
|
||||
)
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
@ -138,6 +177,12 @@ if test "x$WITHOUT_DJBDNS" = "x0"; then
|
||||
AC_CHECK_LIB([djbdns], [dns_transmit_start])
|
||||
fi
|
||||
|
||||
if test "x$WITHOUT_NETSNMP" = "x0"; then
|
||||
NETSNMP_LIBS=`net-snmp-config --netsnmp-agent-libs`
|
||||
LIBS="$LIBS $NETSNMP_LIBS"
|
||||
HAVE_LIBSNMP=1
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# Checks for header files.
|
||||
@ -189,6 +234,8 @@ if test "x$BDB_NOT_FOUND" = "x1"; then
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(ENABLE_VERIFY_CACHE, ${ENABLE_VERIFY_CACHE}, [enable verify cache])
|
||||
AC_DEFINE_UNQUOTED(ENABLE_STATS, ${ENABLE_STATS}, [enable stats])
|
||||
AC_DEFINE_UNQUOTED(HAVE_LIBSNMP, ${HAVE_LIBSNMP}, [have libsnmp])
|
||||
|
||||
|
||||
|
||||
|
@ -87,9 +87,9 @@ RC = @RC@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
|
||||
include_HEADERS = containers_public.h queue.h smtp.h cfg.h count.h safe_write.h sunos_comp.h htdns.h smmapd.h htmalloc.h
|
||||
include_HEADERS = containers_public.h queue.h smtp.h cfg.h count.h safe_write.h sunos_comp.h htdns.h smmapd.h htmalloc.h stats.h
|
||||
lib_LTLIBRARIES = libsmmapdfw.la
|
||||
libsmmapdfw_la_SOURCES = cfg.c queue.c count.c safe_write.c config_public.c htdns.c smtp.c htmalloc.c
|
||||
libsmmapdfw_la_SOURCES = cfg.c queue.c count.c safe_write.c config_public.c htdns.c smtp.c htmalloc.c stats.c
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
@ -103,7 +103,7 @@ LIBS = @LIBS@
|
||||
libsmmapdfw_la_LDFLAGS =
|
||||
libsmmapdfw_la_LIBADD =
|
||||
libsmmapdfw_la_OBJECTS = cfg.lo queue.lo count.lo safe_write.lo \
|
||||
config_public.lo htdns.lo smtp.lo htmalloc.lo
|
||||
config_public.lo htdns.lo smtp.lo htmalloc.lo stats.lo
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
@ -120,7 +120,7 @@ TAR = tar
|
||||
GZIP_ENV = --best
|
||||
DEP_FILES = .deps/cfg.P .deps/config_public.P .deps/count.P \
|
||||
.deps/htdns.P .deps/htmalloc.P .deps/queue.P .deps/safe_write.P \
|
||||
.deps/smtp.P
|
||||
.deps/smtp.P .deps/stats.P
|
||||
SOURCES = $(libsmmapdfw_la_SOURCES)
|
||||
OBJECTS = $(libsmmapdfw_la_OBJECTS)
|
||||
|
||||
|
@ -21,26 +21,67 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define _STATS_C_
|
||||
#include "stats.h"
|
||||
|
||||
count_t statCounter[STAT_CNT_MAXNUM];
|
||||
#include "count.h"
|
||||
|
||||
|
||||
#if ENABLE_STATS==1
|
||||
count_t statCounter[STAT_CNT_MAXNUM];
|
||||
#endif
|
||||
|
||||
void initStatCounter() {
|
||||
#if ENABLE_STATS==1
|
||||
int i;
|
||||
|
||||
for (i=0; i<STAT_CNT_MAXNUM; i++) {
|
||||
count_init(statCounter[i]);
|
||||
count_init(&statCounter[i]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned int getStatCounter(int cnt_idx) {
|
||||
#if ENABLE_STATS==1
|
||||
assert((cnt_idx >= 0) && (cnt_idx < STAT_CNT_MAXNUM));
|
||||
return count_get(&statCounter[cnt_idx]);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void incStatCounter(int cnt_idx) {
|
||||
#if ENABLE_STATS==1
|
||||
assert((cnt_idx >= 0) && (cnt_idx < STAT_CNT_MAXNUM));
|
||||
count_inc(&statCounter[cnt_idx]);
|
||||
#endif
|
||||
}
|
||||
|
||||
void decStatCounter(int cnt_idx) {
|
||||
#if ENABLE_STATS==1
|
||||
assert((cnt_idx >= 0) && (cnt_idx < STAT_CNT_MAXNUM));
|
||||
count_dec(&statCounter[cnt_idx]);
|
||||
#endif
|
||||
}
|
||||
|
||||
void outputStats(int nice) {
|
||||
#if ENABLE_STATS==1
|
||||
int i;
|
||||
|
||||
if (nice)
|
||||
printf("---------------------------------------------------------\n");
|
||||
|
||||
for (i=0; i<STAT_CNT_MAXNUM; i++) {
|
||||
if (nice)
|
||||
printf("%40s = %5d\n", stat_cnt_names[i], getStatCounter(i));
|
||||
else
|
||||
printf("%d ", getStatCounter(i));
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -19,22 +19,41 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _STATS_H
|
||||
#define _STATS_H
|
||||
#ifndef _STATS_H_
|
||||
#define _STATS_H_
|
||||
|
||||
#include "smmapd.h"
|
||||
|
||||
#ifdef _STATS_C_
|
||||
char *stat_cnt_names[] = {
|
||||
"accepted",
|
||||
"failed",
|
||||
"Running networker threads",
|
||||
"Failed to start, networker threads",
|
||||
"returned OK",
|
||||
"returned TEMP_NOK",
|
||||
"returned PERM_NOK",
|
||||
"returned NOT_FOUND_NOK",
|
||||
"returned illegal input",
|
||||
"returned unknown class",
|
||||
"returned TIMEOUT_NOK",
|
||||
"returned netstring unparsable",
|
||||
};
|
||||
#endif /* _STATS_C_ */
|
||||
|
||||
|
||||
#define STAT_CNT_ACCEPTED 0
|
||||
#define STAT_CNT_FAILED 1
|
||||
#define STAT_CNT_OK_RETURNED 2
|
||||
#define STAT_CNT_PERM_RETURNED 3
|
||||
#define STAT_CNT_TEMP_RETURNED 4
|
||||
#define STAT_CNT_NOTFOUND_RETURNED 5
|
||||
#define STAT_CNT_CLASS_NOT_FOUND_FAILURE 6
|
||||
#define STAT_CNT_NETSTRING_FAILURE 7
|
||||
#define STAT_CNT_MAXNUM 8
|
||||
#define STAT_CNT_ACCEPTED 1
|
||||
#define STAT_CNT_FAILED 2
|
||||
#define STAT_CNT_NETWORKER_THREADS 3
|
||||
#define STAT_CNT_NETWORKER_THREADS_FAILED 4
|
||||
|
||||
#define STAT_CNT_OFFSET 4
|
||||
#define STAT_CNT_MAXNUM STAT_CNT_OFFSET + SMM_MAX_NUM
|
||||
|
||||
|
||||
void initStatCounter();
|
||||
unsigned int getStatCounter(int cnt_idx);
|
||||
void incStatCounter(int cnt_idx);
|
||||
void decStatCounter(int cnt_idx);
|
||||
|
||||
#endif _STATS_H_
|
||||
#endif /* _STATS_H_ */
|
||||
|
21
smmapdfw/mib/DE-HOTTIS-MIB.txt
Normal file
21
smmapdfw/mib/DE-HOTTIS-MIB.txt
Normal file
@ -0,0 +1,21 @@
|
||||
DE-HOTTIS-MIB DEFINITIONS ::= BEGIN
|
||||
|
||||
IMPORTS
|
||||
MODULE-IDENTITY, OBJECT-TYPE, Integer32, enterprises FROM SNMPv2-SMI
|
||||
;
|
||||
|
||||
deHottis MODULE-IDENTITY
|
||||
LAST-UPDATED "200411040000Z" -- 04 Nov 2004, midnight
|
||||
ORGANIZATION "hottis.de"
|
||||
CONTACT-INFO "postal: Wolfgang Hottgenroth
|
||||
Eupenstr. 20
|
||||
45259 Essen
|
||||
Germany
|
||||
|
||||
email: woho@hottis.de
|
||||
"
|
||||
DESCRIPTION "My main MIB
|
||||
"
|
||||
::= { enterprises 9676 }
|
||||
|
||||
END
|
148
smmapdfw/mib/DE-HOTTIS-SMMAPD-MIB.txt
Normal file
148
smmapdfw/mib/DE-HOTTIS-SMMAPD-MIB.txt
Normal file
@ -0,0 +1,148 @@
|
||||
DE-HOTTIS-SMMAPD-MIB DEFINITIONS ::= BEGIN
|
||||
|
||||
IMPORTS
|
||||
MODULE-IDENTITY, OBJECT-TYPE, Counter32 FROM SNMPv2-SMI
|
||||
deHottis FROM DE-HOTTIS-MIB
|
||||
;
|
||||
|
||||
deHottisSmmapdMIB MODULE-IDENTITY
|
||||
LAST-UPDATED "200411040000Z" -- 04 Nov 2004, midnight
|
||||
ORGANIZATION "hottis.de"
|
||||
CONTACT-INFO "postal: Wolfgang Hottgenroth
|
||||
Eupenstr. 20
|
||||
45259 Essen
|
||||
Germany
|
||||
|
||||
email: woho@hottis.de
|
||||
"
|
||||
DESCRIPTION "MIB for gathering statistics from smmapd
|
||||
"
|
||||
::= { deHottis 2 }
|
||||
|
||||
dhsMIBObjects OBJECT IDENTIFIER ::= { deHottisSmmapdMIB 1 }
|
||||
|
||||
DhsServerStat ::=
|
||||
SEQUENCE {
|
||||
dhsAccepted Counter32,
|
||||
dhsFailed Counter32,
|
||||
dhsRunningNwThreads Integer32,
|
||||
dhsFailedNwThreads Counter32,
|
||||
dhsOKReturned Counter32,
|
||||
dhsTEMPReturned Counter32,
|
||||
dhsPERMReturned Counter32,
|
||||
dhsNOTFOUNDReturned Counter32,
|
||||
dhsIllegalInputFailre Counter32,
|
||||
dhsUnknownClassFailure Counter32,
|
||||
dhsTimeoutFailure Counter32,
|
||||
dhsNetStringFailure Counter32
|
||||
}
|
||||
|
||||
dhsServerStat OBJECT-TYPE
|
||||
SYNTAX DhsServerStat
|
||||
MAX-ACCESS not-accessible
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Statistics of the server"
|
||||
::= { dhsMIBObjects 1 }
|
||||
|
||||
|
||||
dhsAccepted OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Connections accepted by the server"
|
||||
::= { dhsServerStat 1 }
|
||||
|
||||
dhsFailed OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Connections the server failed to accept"
|
||||
::= { dhsServerStat 2 }
|
||||
|
||||
dhsRunningNwThreads OBJECT-TYPE
|
||||
SYNTAX Integer32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Running networker threads"
|
||||
::= { dhsServerStat 3 }
|
||||
|
||||
dhsFailedNwThreads OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Networker threads failed to start"
|
||||
::= { dhsServerStat 4 }
|
||||
|
||||
dhsOKReturned OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"OK returned to sendmail"
|
||||
::= { dhsServerStat 5 }
|
||||
|
||||
dhsTEMPReturned OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"TEMP failure returned to sendmail"
|
||||
::= { dhsServerStat 6 }
|
||||
|
||||
dhsPERMReturned OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"PERM failure returned to sendmail"
|
||||
::= { dhsServerStat 7 }
|
||||
|
||||
dhsNOTFOUNDReturned OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"NOTFOUND returned to sendmail"
|
||||
::= { dhsServerStat 8 }
|
||||
|
||||
dhsIllegalInputFailure OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Class not found (PERM) returned to sendmail"
|
||||
::= { dhsServerStat 9 }
|
||||
|
||||
dhsUnknownClassFailure OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Class not found (PERM) returned to sendmail"
|
||||
::= { dhsServerStat 10 }
|
||||
|
||||
dhsTimeoutFailure OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Timeout failure returned to sendmail"
|
||||
::= { dhsServerStat 11 }
|
||||
|
||||
dhsNetStringFailure OBJECT-TYPE
|
||||
SYNTAX Counter32
|
||||
MAX-ACCESS read-only
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"NetString (NOK) returned to sendmail"
|
||||
::= { dhsServerStat 12 }
|
||||
|
||||
|
||||
|
||||
|
||||
END
|
@ -1,7 +1,7 @@
|
||||
noinst_HEADERS = containers.h
|
||||
noinst_HEADERS = containers.h snmp_subagent.h
|
||||
sysconf_DATA = smmapd.ini
|
||||
bin_PROGRAMS = smmapd
|
||||
smmapd_SOURCES = smmapd.c containers.c
|
||||
smmapd_SOURCES = smmapd.c containers.c snmp_subagent.c
|
||||
smmapd_LDADD = ../libsmmapdfw/libsmmapdfw.la
|
||||
|
||||
INCLUDES = -I../libsmmapdfw
|
||||
|
@ -87,10 +87,10 @@ RC = @RC@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
|
||||
noinst_HEADERS = containers.h
|
||||
noinst_HEADERS = containers.h snmp_subagent.h
|
||||
sysconf_DATA = smmapd.ini
|
||||
bin_PROGRAMS = smmapd
|
||||
smmapd_SOURCES = smmapd.c containers.c
|
||||
smmapd_SOURCES = smmapd.c containers.c snmp_subagent.c
|
||||
smmapd_LDADD = ../libsmmapdfw/libsmmapdfw.la
|
||||
|
||||
INCLUDES = -I../libsmmapdfw
|
||||
@ -107,7 +107,8 @@ PROGRAMS = $(bin_PROGRAMS)
|
||||
DEFS = @DEFS@ -I. -I$(srcdir) -I..
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
smmapd_OBJECTS = smmapd.$(OBJEXT) containers.$(OBJEXT)
|
||||
smmapd_OBJECTS = smmapd.$(OBJEXT) containers.$(OBJEXT) \
|
||||
snmp_subagent.$(OBJEXT)
|
||||
smmapd_DEPENDENCIES = ../libsmmapdfw/libsmmapdfw.la
|
||||
smmapd_LDFLAGS =
|
||||
CFLAGS = @CFLAGS@
|
||||
@ -126,7 +127,7 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP_ENV = --best
|
||||
DEP_FILES = .deps/containers.P .deps/smmapd.P
|
||||
DEP_FILES = .deps/containers.P .deps/smmapd.P .deps/snmp_subagent.P
|
||||
SOURCES = $(smmapd_SOURCES)
|
||||
OBJECTS = $(smmapd_OBJECTS)
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
@ -68,6 +67,8 @@
|
||||
#define _SMMAPD_C_
|
||||
#include "smmapd.h"
|
||||
|
||||
#include "stats.h"
|
||||
#include "snmp_subagent.h"
|
||||
|
||||
#include "sunos_comp.h"
|
||||
|
||||
@ -95,10 +96,35 @@ typedef struct networkerThread_s networkerThread_t;
|
||||
|
||||
ht_queue_t terminated_networker_queue;
|
||||
pthread_t cleanerThread;
|
||||
|
||||
#if ENABLE_STATS==1
|
||||
pthread_t statsThread;
|
||||
#endif
|
||||
|
||||
#if HAVE_LIBSNMP==1
|
||||
pthread_t snmpThread;
|
||||
#endif
|
||||
count_t thread_counter;
|
||||
|
||||
cfg_t *cfg;
|
||||
|
||||
#if ENABLE_STATS==1
|
||||
void * statser(void * arg) {
|
||||
int nice = atoi(findcfgx(cfg, "stats", "nice", "0"));
|
||||
int period = atoi(findcfgx(cfg, "stats", "period", "10"));
|
||||
|
||||
while(1) {
|
||||
outputStats(nice);
|
||||
sleep(period);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAVE_LIBSNMP==1
|
||||
void * snmper(void * arg) {
|
||||
snmp_subagent_main();
|
||||
}
|
||||
#endif
|
||||
|
||||
void * cleaner(void * arg) {
|
||||
networkerThread_t *t;
|
||||
@ -111,6 +137,7 @@ void * cleaner(void * arg) {
|
||||
count_get(&thread_counter));
|
||||
t = (networkerThread_t*) queue_get_wait(&terminated_networker_queue);
|
||||
count_dec(&thread_counter);
|
||||
decStatCounter(STAT_CNT_NETWORKER_THREADS);
|
||||
|
||||
syslog(LOG_DEBUG, "cleaner: Networker serving %d (address: %s, port: %d), result %d",
|
||||
t->clientSock, inet_ntoa(t->clientAddr.sin_addr),
|
||||
@ -181,6 +208,8 @@ void * networker(void * arg) {
|
||||
syslog(LOG_DEBUG, "networker: dispatcher result: %d, answer: %s", dispatcher_result, answer);
|
||||
}
|
||||
|
||||
incStatCounter(dispatcher_result + STAT_CNT_OFFSET);
|
||||
|
||||
result_text = (dispatcher_result > SMM_MAX_NUM) ?
|
||||
T_SMM_RESULTS[0] :
|
||||
T_SMM_RESULTS[dispatcher_result];
|
||||
@ -222,7 +251,9 @@ int server() {
|
||||
networkerThread_t *thread;
|
||||
pthread_t tid;
|
||||
int optval = 1;
|
||||
|
||||
int enableStats;
|
||||
int enableSnmp;
|
||||
|
||||
char *cfg_address, *cfg_port;
|
||||
|
||||
serverSock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
@ -266,6 +297,21 @@ int server() {
|
||||
queue_init(&terminated_networker_queue);
|
||||
pthread_create(&cleanerThread, NULL, &cleaner, NULL);
|
||||
|
||||
#if ENABLE_STATS==1
|
||||
enableStats = atoi(findcfgx(cfg, "global", "enable_stats", "0"));
|
||||
if (enableStats) {
|
||||
syslog(LOG_INFO, "server: starting stats thread");
|
||||
pthread_create(&statsThread, NULL, &statser, NULL);
|
||||
}
|
||||
#endif /* ENABLE_STATS */
|
||||
|
||||
#if HAVE_LIBSNMP==1
|
||||
enableSnmp = atoi(findcfgx(cfg, "global", "enable_snmp", "0"));
|
||||
if (enableSnmp) {
|
||||
syslog(LOG_INFO, "server: starting snmp subagent thread");
|
||||
pthread_create(&snmpThread, NULL, &snmper, NULL);
|
||||
}
|
||||
#endif /* HAVE_LIBSNMP */
|
||||
|
||||
while (1) {
|
||||
syslog(LOG_DEBUG, "server: Waiting for connection");
|
||||
@ -274,11 +320,13 @@ int server() {
|
||||
syslog(LOG_DEBUG, "server: Got a connection %d", clientSock);
|
||||
|
||||
if (-1 == clientSock) {
|
||||
incStatCounter(STAT_CNT_FAILED);
|
||||
syslog(LOG_ERR, "server: failure when accepting connection: %d, %s",
|
||||
errno, strerror(errno));
|
||||
continue;
|
||||
}
|
||||
|
||||
incStatCounter(STAT_CNT_ACCEPTED);
|
||||
|
||||
thread = (networkerThread_t *) htmalloc(sizeof(networkerThread_t)+10);
|
||||
if (NULL == thread) {
|
||||
@ -293,10 +341,13 @@ int server() {
|
||||
thread->clientAddrLen = clientAddrLen;
|
||||
|
||||
count_inc(&thread_counter);
|
||||
incStatCounter(STAT_CNT_NETWORKER_THREADS);
|
||||
res = pthread_create(&tid, NULL, &networker, thread);
|
||||
if (0 != res) {
|
||||
syslog(LOG_ERR, "server: unable to start networker thread");
|
||||
free(thread);
|
||||
decStatCounter(STAT_CNT_NETWORKER_THREADS);
|
||||
incStatCounter(STAT_CNT_NETWORKER_THREADS_FAILED);
|
||||
count_dec(&thread_counter);
|
||||
continue;
|
||||
}
|
||||
|
@ -6,6 +6,15 @@ port = 8887
|
||||
; plugin_dir = /home/who/Sources/sf/smmapdfw
|
||||
; plugins = test_worker1 test_worker2 verifier cyruscheck lua_worker
|
||||
plugins = verifier
|
||||
enable_stats = 1
|
||||
; enable_snmp = 0
|
||||
|
||||
[snmp]
|
||||
|
||||
[stats]
|
||||
nice = 1
|
||||
period = 5
|
||||
|
||||
|
||||
[test_worker1]
|
||||
obj = libtest_workers.so
|
||||
|
164
smmapdfw/smmapd/snmp_subagent.c
Normal file
164
smmapdfw/smmapd/snmp_subagent.c
Normal file
@ -0,0 +1,164 @@
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_LIBSNMP
|
||||
#include <net-snmp/net-snmp-config.h>
|
||||
#include <net-snmp/net-snmp-includes.h>
|
||||
#include <net-snmp/agent/net-snmp-agent-includes.h>
|
||||
|
||||
int
|
||||
handle_it(netsnmp_mib_handler *handler,
|
||||
netsnmp_handler_registration *reginfo,
|
||||
netsnmp_agent_request_info *reqinfo,
|
||||
netsnmp_request_info *requests)
|
||||
{
|
||||
static int the_number = 42;
|
||||
|
||||
/*
|
||||
* We are never called for a GETNEXT if it's registered as a
|
||||
* "instance", as it's "magically" handled for us.
|
||||
*/
|
||||
|
||||
/*
|
||||
* a instance handler also only hands us one request at a time, so
|
||||
* we don't need to loop over a list of requests; we'll only get one.
|
||||
*/
|
||||
|
||||
switch (reqinfo->mode) {
|
||||
|
||||
case MODE_GET:
|
||||
snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
|
||||
(u_char *)
|
||||
/* XXX: a pointer to the scalar's data */
|
||||
&the_number
|
||||
,
|
||||
/*
|
||||
* XXX: the length of the data in bytes
|
||||
*/
|
||||
sizeof(the_number));
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
/*
|
||||
* we should never get here, so this is a really bad error
|
||||
*/
|
||||
return SNMP_ERR_GENERR;
|
||||
}
|
||||
|
||||
return SNMP_ERR_NOERROR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
init_subagent(void)
|
||||
{
|
||||
static oid dhsIllegalInputFailure_oid[] =
|
||||
{ 1, 3, 6, 1, 4, 1, 9676, 2, 1, 1, 9 };
|
||||
static oid dhsOKReturned_oid[] =
|
||||
{ 1, 3, 6, 1, 4, 1, 9676, 2, 1, 1, 5 };
|
||||
static oid dhsTEMPReturned_oid[] =
|
||||
{ 1, 3, 6, 1, 4, 1, 9676, 2, 1, 1, 6 };
|
||||
static oid dhsNetStringFailure_oid[] =
|
||||
{ 1, 3, 6, 1, 4, 1, 9676, 2, 1, 1, 12 };
|
||||
static oid dhsRunningNwThreads_oid[] =
|
||||
{ 1, 3, 6, 1, 4, 1, 9676, 2, 1, 1, 3 };
|
||||
static oid dhsFailedNwThreads_oid[] =
|
||||
{ 1, 3, 6, 1, 4, 1, 9676, 2, 1, 1, 4 };
|
||||
static oid dhsUnknownClassFailure_oid[] =
|
||||
{ 1, 3, 6, 1, 4, 1, 9676, 2, 1, 1, 10 };
|
||||
static oid dhsFailed_oid[] =
|
||||
{ 1, 3, 6, 1, 4, 1, 9676, 2, 1, 1, 2 };
|
||||
static oid dhsNOTFOUNDReturned_oid[] =
|
||||
{ 1, 3, 6, 1, 4, 1, 9676, 2, 1, 1, 8 };
|
||||
static oid dhsAccepted_oid[] =
|
||||
{ 1, 3, 6, 1, 4, 1, 9676, 2, 1, 1, 1 };
|
||||
static oid dhsPERMReturned_oid[] =
|
||||
{ 1, 3, 6, 1, 4, 1, 9676, 2, 1, 1, 7 };
|
||||
static oid dhsTimeoutFailure_oid[] =
|
||||
{ 1, 3, 6, 1, 4, 1, 9676, 2, 1, 1, 11 };
|
||||
|
||||
DEBUGMSGTL(("smmapd_snmp_subagent", "Initializing\n"));
|
||||
|
||||
netsnmp_register_scalar(netsnmp_create_handler_registration
|
||||
("dhsIllegalInputFailure",
|
||||
handle_it,
|
||||
dhsIllegalInputFailure_oid,
|
||||
OID_LENGTH(dhsIllegalInputFailure_oid),
|
||||
HANDLER_CAN_RONLY));
|
||||
netsnmp_register_scalar(netsnmp_create_handler_registration
|
||||
("dhsOKReturned", handle_it,
|
||||
dhsOKReturned_oid,
|
||||
OID_LENGTH(dhsOKReturned_oid),
|
||||
HANDLER_CAN_RONLY));
|
||||
netsnmp_register_scalar(netsnmp_create_handler_registration
|
||||
("dhsTEMPReturned", handle_it,
|
||||
dhsTEMPReturned_oid,
|
||||
OID_LENGTH(dhsTEMPReturned_oid),
|
||||
HANDLER_CAN_RONLY));
|
||||
netsnmp_register_scalar(netsnmp_create_handler_registration
|
||||
("dhsNetStringFailure",
|
||||
handle_it,
|
||||
dhsNetStringFailure_oid,
|
||||
OID_LENGTH(dhsNetStringFailure_oid),
|
||||
HANDLER_CAN_RONLY));
|
||||
netsnmp_register_scalar(netsnmp_create_handler_registration
|
||||
("dhsRunningNwThreads",
|
||||
handle_it,
|
||||
dhsRunningNwThreads_oid,
|
||||
OID_LENGTH(dhsRunningNwThreads_oid),
|
||||
HANDLER_CAN_RONLY));
|
||||
netsnmp_register_scalar(netsnmp_create_handler_registration
|
||||
("dhsFailedNwThreads",
|
||||
handle_it,
|
||||
dhsFailedNwThreads_oid,
|
||||
OID_LENGTH(dhsFailedNwThreads_oid),
|
||||
HANDLER_CAN_RONLY));
|
||||
netsnmp_register_scalar(netsnmp_create_handler_registration
|
||||
("dhsUnknownClassFailure",
|
||||
handle_it,
|
||||
dhsUnknownClassFailure_oid,
|
||||
OID_LENGTH(dhsUnknownClassFailure_oid),
|
||||
HANDLER_CAN_RONLY));
|
||||
netsnmp_register_scalar(netsnmp_create_handler_registration
|
||||
("dhsFailed", handle_it, dhsFailed_oid,
|
||||
OID_LENGTH(dhsFailed_oid),
|
||||
HANDLER_CAN_RONLY));
|
||||
netsnmp_register_scalar(netsnmp_create_handler_registration
|
||||
("dhsNOTFOUNDReturned",
|
||||
handle_it,
|
||||
dhsNOTFOUNDReturned_oid,
|
||||
OID_LENGTH(dhsNOTFOUNDReturned_oid),
|
||||
HANDLER_CAN_RONLY));
|
||||
netsnmp_register_scalar(netsnmp_create_handler_registration
|
||||
("dhsAccepted", handle_it,
|
||||
dhsAccepted_oid, OID_LENGTH(dhsAccepted_oid),
|
||||
HANDLER_CAN_RONLY));
|
||||
netsnmp_register_scalar(netsnmp_create_handler_registration
|
||||
("dhsPERMReturned", handle_it,
|
||||
dhsPERMReturned_oid,
|
||||
OID_LENGTH(dhsPERMReturned_oid),
|
||||
HANDLER_CAN_RONLY));
|
||||
netsnmp_register_scalar(netsnmp_create_handler_registration
|
||||
("dhsTimeoutFailure", handle_it,
|
||||
dhsTimeoutFailure_oid,
|
||||
OID_LENGTH(dhsTimeoutFailure_oid),
|
||||
HANDLER_CAN_RONLY));
|
||||
}
|
||||
|
||||
void snmp_subagent_main () {
|
||||
snmp_enable_stderrlog();
|
||||
netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE, 1);
|
||||
init_agent("smmapd_subagent");
|
||||
init_subagent();
|
||||
init_snmp("smmapd_subagent");
|
||||
|
||||
/* main loop here... */
|
||||
while(1) {
|
||||
agent_check_and_process(1);
|
||||
}
|
||||
|
||||
/* at shutdown time */
|
||||
snmp_shutdown("mysubagent");
|
||||
}
|
||||
#endif
|
34
smmapdfw/smmapd/snmp_subagent.h
Normal file
34
smmapdfw/smmapd/snmp_subagent.h
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
Copyright (C) 2004, Wolfgang Hottgenroth
|
||||
|
||||
This file is part of smmapdfw.
|
||||
|
||||
smmapdfw 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.
|
||||
|
||||
smmapdfw 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 smmapdfw. If not, write to the Free Software Foundation, 59
|
||||
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _SNMP_SUBAGENT_H_
|
||||
#define _SNMP_SUBAGENT_H_
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_LIBSNMP
|
||||
void snmp_subagent_main();
|
||||
#endif
|
||||
|
||||
#endif /* _SNMP_SUBAGENT_H_ */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user