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.

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