Merge pull request #15105 from TDT-AG/pr/20210312-collectd
collectd: enable smart plugin
This commit is contained in:
commit
aa4a02a68c
6 changed files with 3432 additions and 7 deletions
98
libs/libatasmart/Makefile
Normal file
98
libs/libatasmart/Makefile
Normal file
|
@ -0,0 +1,98 @@
|
|||
#
|
||||
# Copyright (C) 2021 TDT AG <development@tdt.de>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See https://www.gnu.org/licenses/gpl-2.0.txt for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libatasmart
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://git.0pointer.net/libatasmart.git
|
||||
PKG_SOURCE_DATE:=2012-05-21
|
||||
PKG_SOURCE_VERSION:=de6258940960443038b4c1651dfda3620075e870
|
||||
PKG_MIRROR_HASH:=6d2a8782d16e4c1b909e5e836c43c6d58d65b0e1698a53a463a8694a396eb0d7
|
||||
|
||||
PKG_MAINTAINER:=Florian Eckert <fe@dev.tdt.de>
|
||||
PKG_LICENSE:=LGPL-2.1
|
||||
PKG_LICENSE_FILES:=LGPL
|
||||
|
||||
PKG_REMOVE_FILES:=autogen.sh
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_INSTALL:=1
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_BUILD_DEPENDS:=libatasmart/host
|
||||
|
||||
# Do not do autoconf FIXUP for host.
|
||||
# We only need Host Compiled strpool binary.
|
||||
HOST_FIXUP:=
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
define Package/libatasmart
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=S.M.A.R.T. Reading and Parsing Library
|
||||
URL:=https://git.0pointer.net/libatasmart.git
|
||||
DEPENDS:= +libudev
|
||||
endef
|
||||
|
||||
define Package/libatasmart/description
|
||||
This library is supposed to be lean and small and thus
|
||||
supports only a subset of the S.M.A.R.T. functionality.
|
||||
However, I claim that it implements the relevant part of it.
|
||||
If you need full control over all S.M.A.R.T. functionality of
|
||||
your hardware please refer to smartmontools.
|
||||
endef
|
||||
|
||||
define Host/Configure
|
||||
endef
|
||||
|
||||
define Host/Compile
|
||||
$(RM) -rf $(HOST_BUILD_DIR)/strpool
|
||||
$(HOSTCC) $(HOST_CFLAGS) $(HOST_LDFLAGS) \
|
||||
-o $(HOST_BUILD_DIR)/strpool \
|
||||
$(HOST_BUILD_DIR)/strpool.c
|
||||
endef
|
||||
|
||||
define Host/Install
|
||||
$(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin
|
||||
$(INSTALL_BIN) $(HOST_BUILD_DIR)/strpool $(STAGING_DIR_HOSTPKG)/bin
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
$(RM) -rf $(PKG_BUILD_DIR)/strpool
|
||||
$(RM) $(PKG_BUILD_DIR)/strpool.c
|
||||
$(Build/Configure/Default)
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/*.la \
|
||||
$(1)/usr/lib
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* \
|
||||
$(1)/usr/lib
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/*.h \
|
||||
$(1)/usr/include
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc \
|
||||
$(1)/usr/lib/pkgconfig/
|
||||
endef
|
||||
|
||||
define Package/libatasmart/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* \
|
||||
$(1)/usr/lib
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
$(eval $(call BuildPackage,libatasmart))
|
43
libs/libatasmart/patches/001-fix-cross-compile.patch
Normal file
43
libs/libatasmart/patches/001-fix-cross-compile.patch
Normal file
|
@ -0,0 +1,43 @@
|
|||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -114,7 +114,6 @@ dnl###################################
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
-strpool/Makefile
|
||||
libatasmart.pc
|
||||
])
|
||||
AC_OUTPUT
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -22,7 +22,6 @@ AM_LDFLAGS = $(GCLDFLAGS)
|
||||
dist_doc_DATA = README
|
||||
|
||||
EXTRA_DIST = \
|
||||
- autogen.sh \
|
||||
LGPL \
|
||||
README \
|
||||
atasmart.c \
|
||||
@@ -47,9 +46,6 @@ EXTRA_DIST = \
|
||||
blob-examples/WDC_WD5000AAKS--00TMA0-12.01C01 \
|
||||
vala/atasmart.vapi
|
||||
|
||||
-# build the strpool tool first
|
||||
-SUBDIRS = strpool .
|
||||
-
|
||||
CLEANFILES = atasmart.strpool.c
|
||||
|
||||
MAINTAINERCLEANFILES =
|
||||
@@ -94,10 +90,7 @@ libatasmart_la_CFLAGS = \
|
||||
BUILT_SOURCES = \
|
||||
atasmart.strpool.c
|
||||
|
||||
-strpool/strpool:
|
||||
- $(MAKE) -C strpool strpool
|
||||
-
|
||||
-atasmart.strpool.c: atasmart.c strpool/strpool
|
||||
- $(top_builddir)/strpool/strpool $< $@
|
||||
+atasmart.strpool.c: atasmart.c
|
||||
+ $(STAGING_DIR_HOSTPKG)/bin/strpool $< $@
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
3235
libs/libatasmart/src/atasmart.strpool.c
Normal file
3235
libs/libatasmart/src/atasmart.strpool.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
|||
|
||||
PKG_NAME:=collectd
|
||||
PKG_VERSION:=5.12.0
|
||||
PKG_RELEASE:=7
|
||||
PKG_RELEASE:=8
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=https://collectd.org/files/ \
|
||||
|
@ -25,6 +25,10 @@ PKG_INSTALL:=1
|
|||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
PACKAGE_COLLECTD_ENCRYPTED_NETWORK \
|
||||
PACKAGE_COLLECTD_DEBUG_OUTPUT_ENABLE
|
||||
|
||||
COLLECTD_PLUGINS_DISABLED:= \
|
||||
amqp \
|
||||
ampq1 \
|
||||
|
@ -101,7 +105,6 @@ COLLECTD_PLUGINS_DISABLED:= \
|
|||
serial \
|
||||
sigrok \
|
||||
slurm \
|
||||
smart \
|
||||
snmp_agent \
|
||||
statsd \
|
||||
synproxy \
|
||||
|
@ -184,6 +187,7 @@ COLLECTD_PLUGINS_SELECTED:= \
|
|||
routeros \
|
||||
rrdtool \
|
||||
sensors \
|
||||
smart \
|
||||
snmp \
|
||||
snmp6 \
|
||||
swap \
|
||||
|
@ -203,7 +207,7 @@ COLLECTD_PLUGINS_SELECTED:= \
|
|||
vmem \
|
||||
wireless \
|
||||
write_graphite \
|
||||
write_http \
|
||||
write_http
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
$(patsubst %,CONFIG_PACKAGE_collectd-mod-%,$(subst _,-,$(COLLECTD_PLUGINS_SELECTED))) \
|
||||
|
@ -242,17 +246,24 @@ define Package/collectd/config
|
|||
default n
|
||||
depends on PACKAGE_collectd
|
||||
select PACKAGE_collectd-mod-network
|
||||
|
||||
config PACKAGE_COLLECTD_DEBUG_OUTPUT_ENABLE
|
||||
bool "Enable debug output"
|
||||
default n
|
||||
depends on PACKAGE_collectd
|
||||
help
|
||||
Enables the compiler option that collectd is compiled with
|
||||
debugging support. This is used at development stages to get
|
||||
more messages from the collectd during development.
|
||||
endef
|
||||
|
||||
# common configure args
|
||||
CONFIGURE_ARGS+= \
|
||||
--disable-werror \
|
||||
--disable-debug \
|
||||
--enable-daemon \
|
||||
--with-nan-emulation \
|
||||
--with-libyajl=no \
|
||||
--without-perl-bindings \
|
||||
--without-libudev
|
||||
--without-perl-bindings
|
||||
|
||||
CONFIGURE_VARS+= \
|
||||
CFLAGS="$$$$CFLAGS $(FPIC)" \
|
||||
|
@ -274,6 +285,14 @@ CONFIGURE_ARGS+= \
|
|||
--without-libgcrypt
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PACKAGE_COLLECTD_DEBUG_OUTPUT_ENABLE),y)
|
||||
CONFIGURE_ARGS+= \
|
||||
--enable-debug
|
||||
else
|
||||
CONFIGURE_ARGS+= \
|
||||
--disable-debug
|
||||
endif
|
||||
|
||||
CONFIGURE_PLUGIN= \
|
||||
$(foreach m, $(1), \
|
||||
$(if $(CONFIG_PACKAGE_collectd-mod-$(subst _,-,$(m))),--enable-$(m),--disable-$(m)) \
|
||||
|
@ -318,6 +337,15 @@ ifneq ($(CONFIG_PACKAGE_collectd-mod-rrdtool),)
|
|||
CONFIGURE_ARGS+= --with-librrd="$(STAGING_DIR)/usr/lib/rrdtool-1.0"
|
||||
endif
|
||||
|
||||
# exception: mod-smart needs libatasmart
|
||||
ifneq ($(CONFIG_PACKAGE_collectd-mod-smart),)
|
||||
CONFIGURE_ARGS+= \
|
||||
--with-libatasmart="$(STAGING_DIR)/usr" \
|
||||
--with-libudev="$(STAGING_DIR)/usr"
|
||||
else
|
||||
CONFIGURE_ARGS+= --without-libudev
|
||||
endif
|
||||
|
||||
define Package/collectd/conffiles
|
||||
/etc/collectd.conf
|
||||
/etc/config/collectd
|
||||
|
@ -412,7 +440,7 @@ $(eval $(call BuildPlugin,curl,cURL input,curl,+PACKAGE_collectd-mod-curl:libcur
|
|||
#$(eval $(call BuildPlugin,dbi,relational database input,dbi,+PACKAGE_collectd-mod-dbi:libdbi))
|
||||
$(eval $(call BuildPlugin,df,disk space input,df,))
|
||||
$(eval $(call BuildPlugin,dhcpleases,show dhcpleases,dhcpleases,))
|
||||
$(eval $(call BuildPlugin,disk,disk usage/timing input,disk,))
|
||||
$(eval $(call BuildPlugin,disk,disk usage/timing input,disk,+PACKAGE_collectd-mod-smart:libudev))
|
||||
$(eval $(call BuildPlugin,dns,DNS traffic input,dns,+PACKAGE_collectd-mod-dns:libpcap))
|
||||
$(eval $(call BuildPlugin,email,email output,email,))
|
||||
$(eval $(call BuildPlugin,entropy,Entropy amount input,entropy,))
|
||||
|
@ -452,6 +480,7 @@ $(eval $(call BuildPlugin,protocols,network protocols input,protocols,))
|
|||
$(eval $(call BuildPlugin,routeros,MikroTik RouterOS input,routeros,+PACKAGE_collectd-mod-routeros:librouteros))
|
||||
$(eval $(call BuildPlugin,rrdtool,RRDtool output,rrdtool,+PACKAGE_collectd-mod-rrdtool:librrd1))
|
||||
$(eval $(call BuildPlugin,sensors,lm_sensors input,sensors,+PACKAGE_collectd-mod-sensors:libsensors))
|
||||
$(eval $(call BuildPlugin,smart,smart input,smart,+PACKAGE_collectd-mod-smart:libatasmart))
|
||||
$(eval $(call BuildPlugin,snmp,SNMP input,snmp,+PACKAGE_collectd-mod-snmp:libnetsnmp))
|
||||
$(eval $(call BuildPlugin,snmp6,snmp6 input,snmp6,))
|
||||
$(eval $(call BuildPlugin,swap,swap input,swap,))
|
||||
|
|
10
utils/collectd/files/usr/share/collectd/plugin/smart.json
Normal file
10
utils/collectd/files/usr/share/collectd/plugin/smart.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"bool": [
|
||||
"IgnoreSelected",
|
||||
"IgnoreSleepMode",
|
||||
"UseSerial"
|
||||
],
|
||||
"list": [
|
||||
"Disk"
|
||||
]
|
||||
}
|
10
utils/collectd/patches/933-fix-smart-detection.patch
Normal file
10
utils/collectd/patches/933-fix-smart-detection.patch
Normal file
|
@ -0,0 +1,10 @@
|
|||
--- a/src/smart.c
|
||||
+++ b/src/smart.c
|
||||
@@ -610,7 +610,6 @@ static int smart_read(void) {
|
||||
return -1;
|
||||
}
|
||||
udev_enumerate_add_match_subsystem(enumerate, "block");
|
||||
- udev_enumerate_add_match_property(enumerate, "DEVTYPE", "disk");
|
||||
udev_enumerate_scan_devices(enumerate);
|
||||
devices = udev_enumerate_get_list_entry(enumerate);
|
||||
if (devices == NULL) {
|
Loading…
Reference in a new issue