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.

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