Skip to content

Commit

Permalink
nut plugin: Added a plugin to query the upsd' from the network ups …
Browse files Browse the repository at this point in the history
…tools'.
  • Loading branch information
octo committed Mar 30, 2007
1 parent 2f0dfdd commit bc2d940
Show file tree
Hide file tree
Showing 5 changed files with 435 additions and 0 deletions.
30 changes: 30 additions & 0 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,34 @@ else
fi
AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes")

AC_ARG_WITH(libupsclient, [AS_HELP_STRING([--with-libupsclient@<:@=PREFIX@:>@], [Path to libupsclient.])],
[
if test "x$withval" != "xno" && test "x$withval" != "xyes"
then
LDFLAGS="$LDFLAGS -L$withval/lib"
CPPFLAGS="$CPPFLAGS -I$withval/include"
with_libupsclient="yes"
fi
],
[
with_libupsclient="yes"
])
if test "x$with_libupsclient" = "xyes"
then
AC_CHECK_LIB(upsclient, upscli_connect,
[
AC_DEFINE(HAVE_LIBUPSCLIENT, 1, [Define to 1 if you have the upsclient library (-lupsclient).])
], [with_libupsclient="no (libupsclient not found)"])
fi
if test "x$with_libupsclient" = "xyes"
then
AC_CHECK_HEADERS(upsclient.h,
[
AC_DEFINE(HAVE_UPSCLIENT_H, 1, [Define to 1 if you have the <upsclient.h> header file.])
], [with_libupsclient="no (upsclient.h not found)"])
fi
AM_CONDITIONAL(BUILD_WITH_LIBUPSCLIENT, test "x$with_libupsclient" = "xyes")

# Check for enabled/disabled features
#

Expand Down Expand Up @@ -1178,6 +1206,7 @@ AC_COLLECTD([mysql], [disable], [module], [mysql statistics])
AC_COLLECTD([network], [disable], [module], [network functionality])
AC_COLLECTD([nfs], [disable], [module], [nfs statistics])
AC_COLLECTD([ntpd], [disable], [module], [ntpd statistics])
AC_COLLECTD([nut], [disable], [module], [network UPS tools statistics])
AC_COLLECTD([ping], [disable], [module], [ping statistics])
AC_COLLECTD([processes], [disable], [module], [processes statistics])
AC_COLLECTD([sensors], [disable], [module], [lm_sensors statistics])
Expand Down Expand Up @@ -1240,6 +1269,7 @@ Configuration:
network . . . . . . $enable_network
nfs . . . . . . . . $enable_nfs
ntpd . . . . . . . $enable_ntpd
nut . . . . . . . . $enable_nut
ping . . . . . . . $enable_ping
processes . . . . . $enable_processes
sensors . . . . . . $enable_sensors
Expand Down
14 changes: 14 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,20 @@ collectd_LDADD += "-dlopen" ntpd.la
collectd_DEPENDENCIES += ntpd.la
endif

if BUILD_MODULE_NUT
pkglib_LTLIBRARIES += nut.la
nut_la_SOURCES = nut.c
nut_la_LDFLAGS = -module -avoid-version
if BUILD_WITH_LIBUPSCLIENT
nut_la_LDFLAGS += -lupsclient
if BUILD_WITH_LIBPTHREAD
nut_la_LDFLAGS += -lpthread
endif
endif
collectd_LDADD += "-dlopen" nut.la
collectd_DEPENDENCIES += nut.la
endif

if BUILD_MODULE_PING
pkglib_LTLIBRARIES += ping.la
ping_la_SOURCES = ping.c
Expand Down
5 changes: 5 additions & 0 deletions src/collectd.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
@BUILD_MODULE_NETWORK_TRUE@LoadPlugin network
@BUILD_MODULE_NFS_TRUE@LoadPlugin nfs
@BUILD_MODULE_NTPD_TRUE@LoadPlugin ntpd
@BUILD_MODULE_NUT_TRUE@LoadPlugin nut
@BUILD_MODULE_PING_TRUE@LoadPlugin ping
@BUILD_MODULE_PROCESSES_TRUE@LoadPlugin processes
@BUILD_WITH_RRDTOOL_TRUE@LoadPlugin rrdtool
Expand Down Expand Up @@ -137,6 +138,10 @@
# Port 123
#</Plugin>

#<Plugin nut>
# UPS "upsname@hostname:port"
#</Plugin>

#<Plugin ping>
# Host "host.foo.bar"
#</Plugin>
Expand Down
11 changes: 11 additions & 0 deletions src/collectd.conf.pod
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,17 @@ UDP-Port to connect to. Defaults to B<123>.

=back

=head2 Plugin C<nut>

=over 4

=item B<UPS> I<upsname>B<@>I<hostname>[B<:>I<port>]

Add a UPS to collect data from. The format is identical to the one accepted by
L<upsc(8)>.

=back

=head2 Plugin C<ping>

=over 4
Expand Down
Loading

0 comments on commit bc2d940

Please sign in to comment.