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.

312 lines
9.5 KiB

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