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.

378 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:=6
  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. cpusleep \
  30. curl_json \
  31. curl_xml \
  32. dbi \
  33. dpdkstat \
  34. drbd \
  35. ethstat \
  36. fhcount \
  37. genericjmx \
  38. gmond \
  39. gps \
  40. grpc \
  41. hddtemp \
  42. hugepages \
  43. intel_rdt \
  44. ipc \
  45. ipmi \
  46. ipvs \
  47. java \
  48. log_logstash \
  49. lua \
  50. lvm \
  51. lpar \
  52. madwifi \
  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. chrony \
  108. conntrack \
  109. contextswitch \
  110. cpu \
  111. cpufreq \
  112. csv \
  113. curl \
  114. df \
  115. disk \
  116. dns \
  117. email \
  118. entropy \
  119. exec \
  120. filecount \
  121. fscache \
  122. interface \
  123. iptables \
  124. irq \
  125. iwinfo \
  126. load \
  127. logfile \
  128. match_empty_counter \
  129. match_hashed \
  130. match_regex \
  131. match_timediff \
  132. match_value \
  133. memory \
  134. modbus \
  135. mysql \
  136. netlink \
  137. network \
  138. nginx \
  139. ntpd \
  140. nut \
  141. olsrd \
  142. onewire \
  143. openvpn \
  144. ping \
  145. postgresql \
  146. powerdns \
  147. processes \
  148. protocols \
  149. rrdtool \
  150. sensors \
  151. snmp \
  152. syslog \
  153. table \
  154. tail \
  155. tail_csv \
  156. tcpconns \
  157. teamspeak2 \
  158. ted \
  159. thermal \
  160. unixsock \
  161. uptime \
  162. users \
  163. vmem \
  164. wireless \
  165. write_graphite \
  166. write_http \
  167. PKG_CONFIG_DEPENDS:= \
  168. $(patsubst %,CONFIG_PACKAGE_collectd-mod-%,$(subst _,-,$(COLLECTD_PLUGINS_SELECTED))) \
  169. include $(INCLUDE_DIR)/package.mk
  170. include $(INCLUDE_DIR)/kernel.mk
  171. define Package/collectd/Default
  172. SECTION:=utils
  173. CATEGORY:=Utilities
  174. TITLE:=Lightweight system statistics collection daemon
  175. URL:=https://collectd.org/
  176. endef
  177. define Package/collectd
  178. $(call Package/collectd/Default)
  179. DEPENDS:= +libpthread +zlib +libltdl +libip4tc
  180. MENU:=1
  181. endef
  182. define Package/collectd/description
  183. collectd is a small daemon which collects system information periodically
  184. and provides mechanismns to store the values in a variety of ways.
  185. endef
  186. ifneq ($(CONFIG_avr32),)
  187. TARGET_CFLAGS += -fsigned-char
  188. endif
  189. # common configure args
  190. CONFIGURE_ARGS+= \
  191. --disable-werror \
  192. --disable-debug \
  193. --enable-daemon \
  194. --with-nan-emulation \
  195. --with-libyajl=no \
  196. --without-libgcrypt \
  197. --without-perl-bindings \
  198. --without-libudev
  199. CONFIGURE_VARS+= \
  200. CFLAGS="$$$$CFLAGS $(FPIC)" \
  201. LDFLAGS="$$$$LDFLAGS -lm -lz" \
  202. KERNEL_DIR="$(LINUX_DIR)" \
  203. CONFIGURE_PLUGIN= \
  204. $(foreach m, $(1), \
  205. $(if $(CONFIG_PACKAGE_collectd-mod-$(subst _,-,$(m))),--enable-$(m),--disable-$(m)) \
  206. )
  207. CONFIGURE_ARGS+= \
  208. $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_SELECTED)) \
  209. $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_DISABLED)) \
  210. # exception: mod-ascent needs libxml2
  211. ifneq ($(CONFIG_PACKAGE_collectd-mod-ascent),)
  212. CONFIGURE_VARS+= \
  213. CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/libxml2"
  214. endif
  215. ifneq ($(CONFIG_BIG_ENDIAN),)
  216. CONFIGURE_ARGS+= --with-fp-layout=endianflip
  217. else
  218. CONFIGURE_ARGS+= --with-fp-layout=nothing
  219. endif
  220. ifneq ($(CONFIG_PACKAGE_collectd-mod-postgresql),)
  221. CONFIGURE_ARGS+= --with-libpq="$(STAGING_DIR)/usr/"
  222. endif
  223. ifneq ($(CONFIG_PACKAGE_collectd-mod-mysql),)
  224. CONFIGURE_ARGS+= --with-libmysql="$(STAGING_DIR)/usr/"
  225. endif
  226. # exception: mod-netlink needs libnetlink from iproute
  227. ifneq ($(CONFIG_PACKAGE_collectd-mod-netlink),)
  228. CONFIGURE_ARGS+= --with-libnetlink="$(STAGING_DIR)/usr"
  229. endif
  230. # exception: mod-modbus needs libmodbus
  231. ifneq ($(CONFIG_PACKAGE_collectd-mod-modbus),)
  232. CONFIGURE_ARGS+= --with-libmodbus="$(STAGING_DIR)/usr"
  233. endif
  234. # exception: mod-onewire needs libow-capi
  235. ifneq ($(CONFIG_PACKAGE_collectd-mod-onewire),)
  236. CONFIGURE_ARGS+= --with-libowcapi="$(STAGING_DIR)/usr"
  237. endif
  238. # exception: mod-rrdtool needs rrdtool-1.0.x
  239. ifneq ($(CONFIG_PACKAGE_collectd-mod-rrdtool),)
  240. CONFIGURE_ARGS+= --with-librrd="$(STAGING_DIR)/usr/lib/rrdtool-1.0"
  241. endif
  242. define Package/collectd/conffiles
  243. /etc/collectd.conf
  244. endef
  245. define Package/collectd/install
  246. $(INSTALL_DIR) $(1)/usr/sbin
  247. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/collectd $(1)/usr/sbin/
  248. $(INSTALL_DIR) $(1)/usr/share/collectd
  249. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/collectd/types.db $(1)/usr/share/collectd/
  250. $(INSTALL_DIR) $(1)/etc
  251. $(INSTALL_CONF) ./files/collectd.conf $(1)/etc/
  252. $(INSTALL_DIR) $(1)/etc/init.d
  253. $(INSTALL_BIN) ./files/collectd.init $(1)/etc/init.d/collectd
  254. $(INSTALL_DIR) $(1)/etc/collectd/conf.d
  255. endef
  256. # 1: plugin name
  257. # 2: plugin title/description
  258. # 3: files
  259. # 4: extra dependency
  260. define BuildPlugin
  261. PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_collectd-mod-$(1)
  262. define Package/collectd-mod-$(1)
  263. $$(call Package/collectd/Default)
  264. TITLE:=$(2) plugin
  265. DEPENDS:= collectd $(4)
  266. endef
  267. define Package/collectd-mod-$(1)/install
  268. $(INSTALL_DIR) $$(1)/usr/lib/collectd
  269. for m in $(3); do \
  270. $(CP) \
  271. $(PKG_INSTALL_DIR)/usr/lib/collectd/$$$$$$$${m}.so \
  272. $$(1)/usr/lib/collectd/ ; \
  273. done
  274. endef
  275. $$(eval $$(call BuildPackage,collectd-mod-$(1)))
  276. endef
  277. $(eval $(call BuildPackage,collectd))
  278. #$(eval $(call BuildPlugin,NAME,DESCRIPTION,FILES,DEPENDENCIES))
  279. $(eval $(call BuildPlugin,apache,apache status input,apache,+PACKAGE_collectd-mod-apache:libcurl))
  280. $(eval $(call BuildPlugin,apcups,apcups status input,apcups,))
  281. $(eval $(call BuildPlugin,ascent,ascent status input,ascent,+PACKAGE_collectd-mod-ascent:libcurl +PACKAGE_collectd-mod-ascent:libxml2))
  282. $(eval $(call BuildPlugin,bind,BIND server/zone input,bind,+PACKAGE_collectd-mod-bind:libcurl +PACKAGE_collectd-mod-bind:libxml2))
  283. $(eval $(call BuildPlugin,chrony,chrony status input,chrony,))
  284. $(eval $(call BuildPlugin,conntrack,connection tracking table size input,conntrack,))
  285. $(eval $(call BuildPlugin,contextswitch,context switch input,contextswitch,))
  286. $(eval $(call BuildPlugin,cpu,CPU input,cpu,))
  287. $(eval $(call BuildPlugin,cpufreq,CPU Freq input,cpufreq,@(TARGET_x86||TARGET_x86_64||TARGET_mvebu||TARGET_ipq806x||TARGET_armvirt))) # Only enable on x86 mvebu ipq806x armvirt
  288. $(eval $(call BuildPlugin,csv,CSV output,csv,))
  289. $(eval $(call BuildPlugin,curl,cURL input,curl,+PACKAGE_collectd-mod-curl:libcurl))
  290. #$(eval $(call BuildPlugin,dbi,relational database input,dbi,+PACKAGE_collectd-mod-dbi:libdbi))
  291. $(eval $(call BuildPlugin,df,disk space input,df,))
  292. $(eval $(call BuildPlugin,disk,disk usage/timing input,disk,))
  293. $(eval $(call BuildPlugin,dns,DNS traffic input,dns,+PACKAGE_collectd-mod-dns:libpcap))
  294. $(eval $(call BuildPlugin,email,email output,email,))
  295. $(eval $(call BuildPlugin,entropy,Entropy amount input,entropy,))
  296. $(eval $(call BuildPlugin,exec,process exec input,exec,))
  297. $(eval $(call BuildPlugin,filecount,file count input,filecount,))
  298. $(eval $(call BuildPlugin,fscache,file-system based caching framework input,fscache,))
  299. $(eval $(call BuildPlugin,interface,network interfaces input,interface,))
  300. $(eval $(call BuildPlugin,iptables,iptables status input,iptables,+PACKAGE_collectd-mod-iptables:iptables +libiptc))
  301. $(eval $(call BuildPlugin,irq,interrupt usage input,irq,))
  302. $(eval $(call BuildPlugin,iwinfo,libiwinfo wireless statistics,iwinfo,+PACKAGE_collectd-mod-iwinfo:libiwinfo))
  303. $(eval $(call BuildPlugin,load,system load input,load,))
  304. $(eval $(call BuildPlugin,logfile,log files output,logfile,))
  305. $(eval $(call BuildPlugin,match-empty-counter,empty-counter match,match_empty_counter,))
  306. $(eval $(call BuildPlugin,match-hashed,hashed match,match_hashed,))
  307. $(eval $(call BuildPlugin,match-regex,regex match,match_regex,))
  308. $(eval $(call BuildPlugin,match-timediff,timediff match,match_timediff,))
  309. $(eval $(call BuildPlugin,match-value,value match,match_value,))
  310. #$(eval $(call BuildPlugin,mysql,MySQL status input,mysql,+PACKAGE_collectd-mod-mysql:libmysqlclient-r))
  311. $(eval $(call BuildPlugin,memory,physical memory usage input,memory,))
  312. $(eval $(call BuildPlugin,modbus,read variables through libmodbus,modbus,+PACKAGE_collectd-mod-modbus:libmodbus))
  313. $(eval $(call BuildPlugin,netlink,netlink input,netlink,+PACKAGE_collectd-mod-netlink:libmnl))
  314. $(eval $(call BuildPlugin,network,network input/output,network,))
  315. $(eval $(call BuildPlugin,nginx,nginx status input,nginx,+PACKAGE_collectd-mod-nginx:libcurl))
  316. $(eval $(call BuildPlugin,ntpd,NTP daemon status input,ntpd,))
  317. $(eval $(call BuildPlugin,nut,UPS monitoring input,nut,+PACKAGE_collectd-mod-nut:nut-common))
  318. $(eval $(call BuildPlugin,olsrd,OLSRd status input,olsrd,))
  319. $(eval $(call BuildPlugin,onewire,onewire sensor input,onewire,+PACKAGE_collectd-mod-onewire:libow-capi @BROKEN))
  320. $(eval $(call BuildPlugin,openvpn,OpenVPN traffic/compression input,openvpn,))
  321. $(eval $(call BuildPlugin,ping,ping status input,ping,+PACKAGE_collectd-mod-ping:liboping))
  322. $(eval $(call BuildPlugin,postgresql,PostgreSQL status input,postgresql,+PACKAGE_collectd-mod-postgresql:libpq))
  323. $(eval $(call BuildPlugin,powerdns,PowerDNS server status input,powerdns,))
  324. $(eval $(call BuildPlugin,processes,process status input,processes,))
  325. $(eval $(call BuildPlugin,protocols,network protocols input,protocols,))
  326. $(eval $(call BuildPlugin,rrdtool,RRDtool output,rrdtool,+PACKAGE_collectd-mod-rrdtool:librrd1))
  327. $(eval $(call BuildPlugin,sensors,lm_sensors input,sensors,+PACKAGE_collectd-mod-sensors:libsensors))
  328. $(eval $(call BuildPlugin,snmp,SNMP input,snmp,+PACKAGE_collectd-mod-snmp:libnetsnmp))
  329. $(eval $(call BuildPlugin,syslog,syslog output,syslog,))
  330. $(eval $(call BuildPlugin,tail,tail input,tail,))
  331. $(eval $(call BuildPlugin,tail-csv,tail CSV input,tail_csv,))
  332. $(eval $(call BuildPlugin,table,table-like structured file input,table,))
  333. $(eval $(call BuildPlugin,teamspeak2,TeamSpeak2 input,teamspeak2,))
  334. $(eval $(call BuildPlugin,ted,The Energy Detective input,ted,@((!TARGET_avr32)||BROKEN))) # fails on avr32 because of warnings treated as errors
  335. $(eval $(call BuildPlugin,tcpconns,TCP connection tracking input,tcpconns,))
  336. $(eval $(call BuildPlugin,thermal,system temperatures input,thermal,))
  337. $(eval $(call BuildPlugin,unixsock,unix socket output,unixsock,))
  338. $(eval $(call BuildPlugin,uptime,uptime status input,uptime,))
  339. $(eval $(call BuildPlugin,users,user logged in status input,users,))
  340. $(eval $(call BuildPlugin,vmem,virtual memory usage input,vmem,))
  341. $(eval $(call BuildPlugin,wireless,wireless status input,wireless,))
  342. $(eval $(call BuildPlugin,write-graphite,Carbon/Graphite output,write_graphite,+PACKAGE_collectd-mod-write-graphite:libpthread))
  343. $(eval $(call BuildPlugin,write-http,HTTP POST output,write_http,+PACKAGE_collectd-mod-write-http:libcurl))