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.

346 lines
10 KiB

  1. #
  2. # Copyright (C) 2006-2015 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.0
  10. PKG_RELEASE:=4
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  12. PKG_SOURCE_URL:=http://collectd.org/files/
  13. PKG_MD5SUM:=c39305ef5514b44238b0d31f77e29e6a
  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. 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. nut \
  58. openldap \
  59. openvz \
  60. oracle \
  61. perl \
  62. pf \
  63. pinba \
  64. python \
  65. redis \
  66. routeros \
  67. rrdcached \
  68. serial \
  69. sigrok \
  70. smart \
  71. statsd \
  72. swap \
  73. tape \
  74. tokyotyrant \
  75. turbostat \
  76. uuid \
  77. varnish \
  78. virt \
  79. vserver \
  80. write_kafka \
  81. write_log \
  82. write_mongodb \
  83. write_redis \
  84. write_riemann \
  85. write_sensu \
  86. write_tsdb \
  87. xmms \
  88. zfs_arc \
  89. zookeeper
  90. COLLECTD_PLUGINS_SELECTED:= \
  91. apache \
  92. apcups \
  93. ascent \
  94. bind \
  95. conntrack \
  96. contextswitch \
  97. cpu \
  98. csv \
  99. curl \
  100. df \
  101. disk \
  102. dns \
  103. email \
  104. entropy \
  105. exec \
  106. filecount \
  107. fscache \
  108. interface \
  109. iptables \
  110. irq \
  111. iwinfo \
  112. load \
  113. logfile \
  114. madwifi \
  115. memory \
  116. modbus \
  117. mysql \
  118. netlink \
  119. network \
  120. nginx \
  121. ntpd \
  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. ifneq ($(CONFIG_avr32),)
  167. TARGET_CFLAGS += -fsigned-char
  168. endif
  169. # common configure args
  170. CONFIGURE_ARGS+= \
  171. --disable-debug \
  172. --enable-daemon \
  173. --with-nan-emulation \
  174. --without-libgcrypt
  175. CONFIGURE_VARS+= \
  176. CFLAGS="$$$$CFLAGS $(FPIC)" \
  177. LDFLAGS="$$$$LDFLAGS -lm -lz" \
  178. KERNEL_DIR="$(LINUX_DIR)" \
  179. CONFIGURE_PLUGIN= \
  180. $(foreach m, $(1), \
  181. $(if $(CONFIG_PACKAGE_collectd-mod-$(subst _,-,$(m))),--enable-$(m),--disable-$(m)) \
  182. )
  183. CONFIGURE_ARGS+= \
  184. $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_SELECTED)) \
  185. $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_DISABLED)) \
  186. # exception: mod-ascent needs libxml2
  187. ifneq ($(CONFIG_PACKAGE_collectd-mod-ascent),)
  188. CONFIGURE_VARS+= \
  189. CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/libxml2"
  190. endif
  191. ifneq ($(CONFIG_BIG_ENDIAN),)
  192. CONFIGURE_ARGS+= --with-fp-layout=endianflip
  193. else
  194. CONFIGURE_ARGS+= --with-fp-layout=nothing
  195. endif
  196. ifneq ($(CONFIG_PACKAGE_collectd-mod-postgresql),)
  197. CONFIGURE_ARGS+= --with-libpq="$(STAGING_DIR)/usr/"
  198. endif
  199. ifneq ($(CONFIG_PACKAGE_collectd-mod-mysql),)
  200. CONFIGURE_ARGS+= --with-libmysql="$(STAGING_DIR)/usr/"
  201. endif
  202. # exception: mod-netlink needs libnetlink from iproute
  203. ifneq ($(CONFIG_PACKAGE_collectd-mod-netlink),)
  204. CONFIGURE_ARGS+= --with-libnetlink="$(STAGING_DIR)/usr"
  205. endif
  206. # exception: mod-modbus needs libmodbus
  207. ifneq ($(CONFIG_PACKAGE_collectd-mod-modbus),)
  208. CONFIGURE_ARGS+= --with-libmodbus="$(STAGING_DIR)/usr"
  209. endif
  210. # exception: mod-onewire needs libow-capi
  211. ifneq ($(CONFIG_PACKAGE_collectd-mod-onewire),)
  212. CONFIGURE_ARGS+= --with-libowcapi="$(STAGING_DIR)/usr"
  213. endif
  214. # exception: mod-rrdtool needs rrdtool-1.0.x
  215. ifneq ($(CONFIG_PACKAGE_collectd-mod-rrdtool),)
  216. CONFIGURE_ARGS+= --with-librrd="$(STAGING_DIR)/usr/lib/rrdtool-1.0"
  217. endif
  218. define Package/collectd/conffiles
  219. /etc/collectd.conf
  220. endef
  221. define Package/collectd/install
  222. $(INSTALL_DIR) $(1)/usr/sbin
  223. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/collectd $(1)/usr/sbin/
  224. $(INSTALL_DIR) $(1)/usr/share/collectd
  225. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/collectd/types.db $(1)/usr/share/collectd/
  226. $(INSTALL_DIR) $(1)/etc
  227. $(INSTALL_CONF) ./files/collectd.conf $(1)/etc/
  228. $(INSTALL_DIR) $(1)/etc/init.d
  229. $(INSTALL_BIN) ./files/collectd.init $(1)/etc/init.d/collectd
  230. endef
  231. # 1: plugin name
  232. # 2: plugin title/description
  233. # 3: files
  234. # 4: extra dependency
  235. define BuildPlugin
  236. PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_collectd-mod-$(1)
  237. define Package/collectd-mod-$(1)
  238. $$(call Package/collectd/Default)
  239. TITLE:=$(2) plugin
  240. DEPENDS:= collectd $(4)
  241. endef
  242. define Package/collectd-mod-$(1)/install
  243. $(INSTALL_DIR) $$(1)/usr/lib/collectd
  244. for m in $(3); do \
  245. $(CP) \
  246. $(PKG_INSTALL_DIR)/usr/lib/collectd/$$$$$$$${m}.so \
  247. $$(1)/usr/lib/collectd/ ; \
  248. done
  249. endef
  250. $$(eval $$(call BuildPackage,collectd-mod-$(1)))
  251. endef
  252. $(eval $(call BuildPackage,collectd))
  253. #$(eval $(call BuildPlugin,NAME,DESCRIPTION,FILES,DEPENDENCIES))
  254. $(eval $(call BuildPlugin,apache,apache status input,apache,+PACKAGE_collectd-mod-apache:libcurl))
  255. $(eval $(call BuildPlugin,apcups,apcups status input,apcups,))
  256. $(eval $(call BuildPlugin,ascent,ascent status input,ascent,+PACKAGE_collectd-mod-ascent:libcurl +PACKAGE_collectd-mod-ascent:libxml2))
  257. $(eval $(call BuildPlugin,bind,BIND server/zone input,bind,+PACKAGE_collectd-mod-bind:libcurl +PACKAGE_collectd-mod-bind:libxml2))
  258. $(eval $(call BuildPlugin,conntrack,connection tracking table size input,conntrack,))
  259. $(eval $(call BuildPlugin,contextswitch,context switch input,contextswitch,))
  260. $(eval $(call BuildPlugin,cpu,CPU input,cpu,))
  261. $(eval $(call BuildPlugin,csv,CSV output,csv,))
  262. $(eval $(call BuildPlugin,curl,cURL input,curl,+PACKAGE_collectd-mod-curl:libcurl))
  263. #$(eval $(call BuildPlugin,dbi,relational database input,dbi,+PACKAGE_collectd-mod-dbi:libdbi))
  264. $(eval $(call BuildPlugin,df,disk space input,df,))
  265. $(eval $(call BuildPlugin,disk,disk usage/timing input,disk,))
  266. $(eval $(call BuildPlugin,dns,DNS traffic input,dns,+PACKAGE_collectd-mod-dns:libpcap))
  267. $(eval $(call BuildPlugin,email,email output,email,))
  268. $(eval $(call BuildPlugin,entropy,Entropy amount input,entropy,))
  269. $(eval $(call BuildPlugin,exec,process exec input,exec,))
  270. $(eval $(call BuildPlugin,filecount,file count input,filecount,))
  271. $(eval $(call BuildPlugin,fscache,file-system based caching framework input,fscache,))
  272. $(eval $(call BuildPlugin,interface,network interfaces input,interface,))
  273. $(eval $(call BuildPlugin,iptables,iptables status input,iptables,+PACKAGE_collectd-mod-iptables:iptables +libiptc))
  274. $(eval $(call BuildPlugin,irq,interrupt usage input,irq,))
  275. $(eval $(call BuildPlugin,iwinfo,libiwinfo wireless statistics,iwinfo,+PACKAGE_collectd-mod-iwinfo:libiwinfo))
  276. $(eval $(call BuildPlugin,load,system load input,load,))
  277. $(eval $(call BuildPlugin,logfile,log files output,logfile,))
  278. $(eval $(call BuildPlugin,madwifi,MadWifi status input,madwifi,))
  279. #$(eval $(call BuildPlugin,mysql,MySQL status input,mysql,+PACKAGE_collectd-mod-mysql:libmysqlclient-r))
  280. $(eval $(call BuildPlugin,memory,physical memory usage input,memory,))
  281. $(eval $(call BuildPlugin,modbus,read variables through libmodbus,modbus,+PACKAGE_collectd-mod-modbus:libmodbus))
  282. $(eval $(call BuildPlugin,netlink,netlink input,netlink,+PACKAGE_collectd-mod-netlink:ip @BROKEN))
  283. $(eval $(call BuildPlugin,network,network input/output,network))
  284. $(eval $(call BuildPlugin,nginx,nginx status input,nginx,+PACKAGE_collectd-mod-nginx:libcurl))
  285. $(eval $(call BuildPlugin,ntpd,NTP daemon status input,ntpd,))
  286. #$(eval $(call BuildPlugin,nut,UPS monitoring input,nut,+PACKAGE_collectd-mod-nut:nut))
  287. $(eval $(call BuildPlugin,olsrd,OLSRd status input,olsrd,))
  288. $(eval $(call BuildPlugin,onewire,onewire sensor input,onewire,+PACKAGE_collectd-mod-onewire:libow-capi @BROKEN))
  289. $(eval $(call BuildPlugin,openvpn,OpenVPN traffic/compression input,openvpn,))
  290. $(eval $(call BuildPlugin,ping,ping status input,ping,+PACKAGE_collectd-mod-ping:liboping))
  291. $(eval $(call BuildPlugin,postgresql,PostgreSQL status input,postgresql,+PACKAGE_collectd-mod-postgresql:libpq))
  292. $(eval $(call BuildPlugin,powerdns,PowerDNS server status input,powerdns,))
  293. $(eval $(call BuildPlugin,processes,process status input,processes,))
  294. $(eval $(call BuildPlugin,protocols,network protocols input,protocols,))
  295. $(eval $(call BuildPlugin,rrdtool,RRDtool output,rrdtool,+PACKAGE_collectd-mod-rrdtool:librrd1))
  296. $(eval $(call BuildPlugin,sensors,lm_sensors input,sensors,+PACKAGE_collectd-mod-sensors:libsensors))
  297. $(eval $(call BuildPlugin,snmp,SNMP input,snmp,+PACKAGE_collectd-mod-snmp:libnetsnmp))
  298. $(eval $(call BuildPlugin,syslog,syslog output,syslog,))
  299. $(eval $(call BuildPlugin,tail,tail input,tail,))
  300. $(eval $(call BuildPlugin,table,table-like structured file input,table,))
  301. $(eval $(call BuildPlugin,teamspeak2,TeamSpeak2 input,teamspeak2,))
  302. $(eval $(call BuildPlugin,ted,The Energy Detective input,ted,@((!TARGET_avr32)||BROKEN))) # fails on avr32 because of warnings treated as errors
  303. $(eval $(call BuildPlugin,tcpconns,TCP connection tracking input,tcpconns,))
  304. $(eval $(call BuildPlugin,thermal,system temperatures input,thermal,))
  305. $(eval $(call BuildPlugin,unixsock,unix socket output,unixsock,))
  306. $(eval $(call BuildPlugin,uptime,uptime status input,uptime,))
  307. $(eval $(call BuildPlugin,users,user logged in status input,users,))
  308. $(eval $(call BuildPlugin,vmem,virtual memory usage input,vmem,))
  309. $(eval $(call BuildPlugin,wireless,wireless status input,wireless,))
  310. $(eval $(call BuildPlugin,write-graphite,Carbon/Graphite output,write_graphite,+PACKAGE_collectd-mod-write-graphite:libpthread))
  311. $(eval $(call BuildPlugin,write-http,HTTP POST output,write_http,+PACKAGE_collectd-mod-write-http:libcurl))