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.

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