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.

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