You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

368 lines
11 KiB

  1. #
  2. # Copyright (C) 2006-2016 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=collectd
  9. PKG_VERSION:=5.7.1
  10. PKG_RELEASE:=2
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  12. PKG_SOURCE_URL:=https://collectd.org/files/ \
  13. https://github.com/collectd/collectd/releases/download/collectd-$(PKG_VERSION)
  14. PKG_HASH:=7edd3643c0842215553b2421d5456f4e9a8a58b07e216b40a7e8e91026d8e501
  15. PKG_FIXUP:=autoreconf
  16. PKG_REMOVE_FILES:=aclocal.m4 libltdl/aclocal.m4
  17. PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>, Hannu Nyman <hannu.nyman@iki.fi>
  18. PKG_INSTALL:=1
  19. PKG_BUILD_PARALLEL:=1
  20. PKG_USE_MIPS16:=0
  21. COLLECTD_PLUGINS_DISABLED:= \
  22. amqp \
  23. apple_sensors \
  24. aquaero \
  25. barometer \
  26. battery \
  27. ceph \
  28. cgroups \
  29. chrony \
  30. cpusleep \
  31. curl_json \
  32. curl_xml \
  33. dbi \
  34. dpdkstat \
  35. drbd \
  36. ethstat \
  37. fhcount \
  38. genericjmx \
  39. gmond \
  40. gps \
  41. grpc \
  42. hddtemp \
  43. hugepages \
  44. intel_rdt \
  45. ipc \
  46. ipmi \
  47. ipvs \
  48. java \
  49. log_logstash \
  50. lua \
  51. lvm \
  52. lpar \
  53. mbmon \
  54. md \
  55. memcachec \
  56. memcached \
  57. mic \
  58. monitorus \
  59. mqtt \
  60. multimeter \
  61. netapp \
  62. nfs \
  63. notify_desktop \
  64. notify_email \
  65. notify_nagios \
  66. numa \
  67. openldap \
  68. openvz \
  69. oracle \
  70. perl \
  71. pf \
  72. pinba \
  73. python \
  74. redis \
  75. routeros \
  76. rrdcached \
  77. serial \
  78. sigrok \
  79. smart \
  80. statsd \
  81. swap \
  82. tape \
  83. tokyotyrant \
  84. turbostat \
  85. uuid \
  86. varnish \
  87. virt \
  88. vserver \
  89. write_kafka \
  90. write_log \
  91. write_mongodb \
  92. write_prometheus \
  93. write_redis \
  94. write_riemann \
  95. write_sensu \
  96. write_tsdb \
  97. xencpu \
  98. xmms \
  99. zfs_arc \
  100. zone \
  101. zookeeper
  102. COLLECTD_PLUGINS_SELECTED:= \
  103. apache \
  104. apcups \
  105. ascent \
  106. bind \
  107. conntrack \
  108. contextswitch \
  109. cpu \
  110. cpufreq \
  111. csv \
  112. curl \
  113. df \
  114. disk \
  115. dns \
  116. email \
  117. entropy \
  118. exec \
  119. filecount \
  120. fscache \
  121. interface \
  122. iptables \
  123. irq \
  124. iwinfo \
  125. load \
  126. logfile \
  127. madwifi \
  128. memory \
  129. modbus \
  130. mysql \
  131. netlink \
  132. network \
  133. nginx \
  134. ntpd \
  135. nut \
  136. olsrd \
  137. onewire \
  138. openvpn \
  139. ping \
  140. postgresql \
  141. powerdns \
  142. processes \
  143. protocols \
  144. rrdtool \
  145. sensors \
  146. snmp \
  147. syslog \
  148. table \
  149. tail \
  150. tail_csv \
  151. tcpconns \
  152. teamspeak2 \
  153. ted \
  154. thermal \
  155. unixsock \
  156. uptime \
  157. users \
  158. vmem \
  159. wireless \
  160. write_graphite \
  161. write_http \
  162. PKG_CONFIG_DEPENDS:= \
  163. $(patsubst %,CONFIG_PACKAGE_collectd-mod-%,$(subst _,-,$(COLLECTD_PLUGINS_SELECTED))) \
  164. include $(INCLUDE_DIR)/package.mk
  165. include $(INCLUDE_DIR)/kernel.mk
  166. define Package/collectd/Default
  167. SECTION:=utils
  168. CATEGORY:=Utilities
  169. TITLE:=Lightweight system statistics collection daemon
  170. URL:=https://collectd.org/
  171. endef
  172. define Package/collectd
  173. $(call Package/collectd/Default)
  174. DEPENDS:= +libpthread +zlib +libltdl +libip4tc
  175. MENU:=1
  176. endef
  177. define Package/collectd/description
  178. collectd is a small daemon which collects system information periodically
  179. and provides mechanismns to store the values in a variety of ways.
  180. endef
  181. ifneq ($(CONFIG_avr32),)
  182. TARGET_CFLAGS += -fsigned-char
  183. endif
  184. # common configure args
  185. CONFIGURE_ARGS+= \
  186. --disable-werror \
  187. --disable-debug \
  188. --enable-daemon \
  189. --with-nan-emulation \
  190. --with-libyajl=no \
  191. --without-libgcrypt \
  192. --without-perl-bindings \
  193. --without-libudev
  194. CONFIGURE_VARS+= \
  195. CFLAGS="$$$$CFLAGS $(FPIC)" \
  196. LDFLAGS="$$$$LDFLAGS -lm -lz" \
  197. KERNEL_DIR="$(LINUX_DIR)" \
  198. CONFIGURE_PLUGIN= \
  199. $(foreach m, $(1), \
  200. $(if $(CONFIG_PACKAGE_collectd-mod-$(subst _,-,$(m))),--enable-$(m),--disable-$(m)) \
  201. )
  202. CONFIGURE_ARGS+= \
  203. $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_SELECTED)) \
  204. $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_DISABLED)) \
  205. # exception: mod-ascent needs libxml2
  206. ifneq ($(CONFIG_PACKAGE_collectd-mod-ascent),)
  207. CONFIGURE_VARS+= \
  208. CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/libxml2"
  209. endif
  210. ifneq ($(CONFIG_BIG_ENDIAN),)
  211. CONFIGURE_ARGS+= --with-fp-layout=endianflip
  212. else
  213. CONFIGURE_ARGS+= --with-fp-layout=nothing
  214. endif
  215. ifneq ($(CONFIG_PACKAGE_collectd-mod-postgresql),)
  216. CONFIGURE_ARGS+= --with-libpq="$(STAGING_DIR)/usr/"
  217. endif
  218. ifneq ($(CONFIG_PACKAGE_collectd-mod-mysql),)
  219. CONFIGURE_ARGS+= --with-libmysql="$(STAGING_DIR)/usr/"
  220. endif
  221. # exception: mod-netlink needs libnetlink from iproute
  222. ifneq ($(CONFIG_PACKAGE_collectd-mod-netlink),)
  223. CONFIGURE_ARGS+= --with-libnetlink="$(STAGING_DIR)/usr"
  224. endif
  225. # exception: mod-modbus needs libmodbus
  226. ifneq ($(CONFIG_PACKAGE_collectd-mod-modbus),)
  227. CONFIGURE_ARGS+= --with-libmodbus="$(STAGING_DIR)/usr"
  228. endif
  229. # exception: mod-onewire needs libow-capi
  230. ifneq ($(CONFIG_PACKAGE_collectd-mod-onewire),)
  231. CONFIGURE_ARGS+= --with-libowcapi="$(STAGING_DIR)/usr"
  232. endif
  233. # exception: mod-rrdtool needs rrdtool-1.0.x
  234. ifneq ($(CONFIG_PACKAGE_collectd-mod-rrdtool),)
  235. CONFIGURE_ARGS+= --with-librrd="$(STAGING_DIR)/usr/lib/rrdtool-1.0"
  236. endif
  237. define Package/collectd/conffiles
  238. /etc/collectd.conf
  239. endef
  240. define Package/collectd/install
  241. $(INSTALL_DIR) $(1)/usr/sbin
  242. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/collectd $(1)/usr/sbin/
  243. $(INSTALL_DIR) $(1)/usr/share/collectd
  244. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/collectd/types.db $(1)/usr/share/collectd/
  245. $(INSTALL_DIR) $(1)/etc
  246. $(INSTALL_CONF) ./files/collectd.conf $(1)/etc/
  247. $(INSTALL_DIR) $(1)/etc/init.d
  248. $(INSTALL_BIN) ./files/collectd.init $(1)/etc/init.d/collectd
  249. $(INSTALL_DIR) $(1)/etc/collectd/conf.d
  250. endef
  251. # 1: plugin name
  252. # 2: plugin title/description
  253. # 3: files
  254. # 4: extra dependency
  255. define BuildPlugin
  256. PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_collectd-mod-$(1)
  257. define Package/collectd-mod-$(1)
  258. $$(call Package/collectd/Default)
  259. TITLE:=$(2) plugin
  260. DEPENDS:= collectd $(4)
  261. endef
  262. define Package/collectd-mod-$(1)/install
  263. $(INSTALL_DIR) $$(1)/usr/lib/collectd
  264. for m in $(3); do \
  265. $(CP) \
  266. $(PKG_INSTALL_DIR)/usr/lib/collectd/$$$$$$$${m}.so \
  267. $$(1)/usr/lib/collectd/ ; \
  268. done
  269. endef
  270. $$(eval $$(call BuildPackage,collectd-mod-$(1)))
  271. endef
  272. $(eval $(call BuildPackage,collectd))
  273. #$(eval $(call BuildPlugin,NAME,DESCRIPTION,FILES,DEPENDENCIES))
  274. $(eval $(call BuildPlugin,apache,apache status input,apache,+PACKAGE_collectd-mod-apache:libcurl))
  275. $(eval $(call BuildPlugin,apcups,apcups status input,apcups,))
  276. $(eval $(call BuildPlugin,ascent,ascent status input,ascent,+PACKAGE_collectd-mod-ascent:libcurl +PACKAGE_collectd-mod-ascent:libxml2))
  277. $(eval $(call BuildPlugin,bind,BIND server/zone input,bind,+PACKAGE_collectd-mod-bind:libcurl +PACKAGE_collectd-mod-bind:libxml2))
  278. $(eval $(call BuildPlugin,conntrack,connection tracking table size input,conntrack,))
  279. $(eval $(call BuildPlugin,contextswitch,context switch input,contextswitch,))
  280. $(eval $(call BuildPlugin,cpu,CPU input,cpu,))
  281. $(eval $(call BuildPlugin,cpufreq,CPU Freq input,cpufreq,@(TARGET_x86||TARGET_x86_64||TARGET_mvebu||TARGET_ipq806x))) # Only enable on x86 mvebu and ipq806x
  282. $(eval $(call BuildPlugin,csv,CSV output,csv,))
  283. $(eval $(call BuildPlugin,curl,cURL input,curl,+PACKAGE_collectd-mod-curl:libcurl))
  284. #$(eval $(call BuildPlugin,dbi,relational database input,dbi,+PACKAGE_collectd-mod-dbi:libdbi))
  285. $(eval $(call BuildPlugin,df,disk space input,df,))
  286. $(eval $(call BuildPlugin,disk,disk usage/timing input,disk,))
  287. $(eval $(call BuildPlugin,dns,DNS traffic input,dns,+PACKAGE_collectd-mod-dns:libpcap))
  288. $(eval $(call BuildPlugin,email,email output,email,))
  289. $(eval $(call BuildPlugin,entropy,Entropy amount input,entropy,))
  290. $(eval $(call BuildPlugin,exec,process exec input,exec,))
  291. $(eval $(call BuildPlugin,filecount,file count input,filecount,))
  292. $(eval $(call BuildPlugin,fscache,file-system based caching framework input,fscache,))
  293. $(eval $(call BuildPlugin,interface,network interfaces input,interface,))
  294. $(eval $(call BuildPlugin,iptables,iptables status input,iptables,+PACKAGE_collectd-mod-iptables:iptables +libiptc))
  295. $(eval $(call BuildPlugin,irq,interrupt usage input,irq,))
  296. $(eval $(call BuildPlugin,iwinfo,libiwinfo wireless statistics,iwinfo,+PACKAGE_collectd-mod-iwinfo:libiwinfo))
  297. $(eval $(call BuildPlugin,load,system load input,load,))
  298. $(eval $(call BuildPlugin,logfile,log files output,logfile,))
  299. $(eval $(call BuildPlugin,madwifi,MadWifi status input,madwifi,))
  300. #$(eval $(call BuildPlugin,mysql,MySQL status input,mysql,+PACKAGE_collectd-mod-mysql:libmysqlclient-r))
  301. $(eval $(call BuildPlugin,memory,physical memory usage input,memory,))
  302. $(eval $(call BuildPlugin,modbus,read variables through libmodbus,modbus,+PACKAGE_collectd-mod-modbus:libmodbus))
  303. $(eval $(call BuildPlugin,netlink,netlink input,netlink,+PACKAGE_collectd-mod-netlink:libmnl))
  304. $(eval $(call BuildPlugin,network,network input/output,network,))
  305. $(eval $(call BuildPlugin,nginx,nginx status input,nginx,+PACKAGE_collectd-mod-nginx:libcurl))
  306. $(eval $(call BuildPlugin,ntpd,NTP daemon status input,ntpd,))
  307. $(eval $(call BuildPlugin,nut,UPS monitoring input,nut,+PACKAGE_collectd-mod-nut:nut-common))
  308. $(eval $(call BuildPlugin,olsrd,OLSRd status input,olsrd,))
  309. $(eval $(call BuildPlugin,onewire,onewire sensor input,onewire,+PACKAGE_collectd-mod-onewire:libow-capi @BROKEN))
  310. $(eval $(call BuildPlugin,openvpn,OpenVPN traffic/compression input,openvpn,))
  311. $(eval $(call BuildPlugin,ping,ping status input,ping,+PACKAGE_collectd-mod-ping:liboping))
  312. $(eval $(call BuildPlugin,postgresql,PostgreSQL status input,postgresql,+PACKAGE_collectd-mod-postgresql:libpq))
  313. $(eval $(call BuildPlugin,powerdns,PowerDNS server status input,powerdns,))
  314. $(eval $(call BuildPlugin,processes,process status input,processes,))
  315. $(eval $(call BuildPlugin,protocols,network protocols input,protocols,))
  316. $(eval $(call BuildPlugin,rrdtool,RRDtool output,rrdtool,+PACKAGE_collectd-mod-rrdtool:librrd1))
  317. $(eval $(call BuildPlugin,sensors,lm_sensors input,sensors,+PACKAGE_collectd-mod-sensors:libsensors))
  318. $(eval $(call BuildPlugin,snmp,SNMP input,snmp,+PACKAGE_collectd-mod-snmp:libnetsnmp))
  319. $(eval $(call BuildPlugin,syslog,syslog output,syslog,))
  320. $(eval $(call BuildPlugin,tail,tail input,tail,))
  321. $(eval $(call BuildPlugin,tail-csv,tail CSV input,tail_csv,))
  322. $(eval $(call BuildPlugin,table,table-like structured file input,table,))
  323. $(eval $(call BuildPlugin,teamspeak2,TeamSpeak2 input,teamspeak2,))
  324. $(eval $(call BuildPlugin,ted,The Energy Detective input,ted,@((!TARGET_avr32)||BROKEN))) # fails on avr32 because of warnings treated as errors
  325. $(eval $(call BuildPlugin,tcpconns,TCP connection tracking input,tcpconns,))
  326. $(eval $(call BuildPlugin,thermal,system temperatures input,thermal,))
  327. $(eval $(call BuildPlugin,unixsock,unix socket output,unixsock,))
  328. $(eval $(call BuildPlugin,uptime,uptime status input,uptime,))
  329. $(eval $(call BuildPlugin,users,user logged in status input,users,))
  330. $(eval $(call BuildPlugin,vmem,virtual memory usage input,vmem,))
  331. $(eval $(call BuildPlugin,wireless,wireless status input,wireless,))
  332. $(eval $(call BuildPlugin,write-graphite,Carbon/Graphite output,write_graphite,+PACKAGE_collectd-mod-write-graphite:libpthread))
  333. $(eval $(call BuildPlugin,write-http,HTTP POST output,write_http,+PACKAGE_collectd-mod-write-http:libcurl))