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.

412 lines
12 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.1
  10. PKG_RELEASE:=5
  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:=e796fda27ce06377f491ad91aa286962a68c2b54076aa77a29673d53204453da
  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. fhcount \
  37. genericjmx \
  38. gmond \
  39. gps \
  40. grpc \
  41. hddtemp \
  42. hugepages \
  43. intel_pmu \
  44. intel_rdt \
  45. ipc \
  46. ipmi \
  47. ipvs \
  48. java \
  49. log_logstash \
  50. lvm \
  51. lpar \
  52. madwifi \
  53. mbmon \
  54. mcelog \
  55. md \
  56. memcachec \
  57. memcached \
  58. mic \
  59. monitorus \
  60. multimeter \
  61. netapp \
  62. nfs \
  63. notify_desktop \
  64. notify_email \
  65. notify_nagios \
  66. numa \
  67. openldap \
  68. openvz \
  69. oracle \
  70. ovs_events \
  71. ovs_stats \
  72. perl \
  73. pf \
  74. pinba \
  75. python \
  76. redis \
  77. routeros \
  78. rrdcached \
  79. serial \
  80. sigrok \
  81. smart \
  82. snmp_agent \
  83. statsd \
  84. swap \
  85. synproxy \
  86. tape \
  87. tokyotyrant \
  88. turbostat \
  89. uuid \
  90. varnish \
  91. virt \
  92. vserver \
  93. write_kafka \
  94. write_log \
  95. write_mongodb \
  96. write_prometheus \
  97. write_redis \
  98. write_riemann \
  99. write_sensu \
  100. write_tsdb \
  101. xencpu \
  102. xmms \
  103. zfs_arc \
  104. zone \
  105. zookeeper
  106. COLLECTD_PLUGINS_SELECTED:= \
  107. apache \
  108. apcups \
  109. ascent \
  110. bind \
  111. chrony \
  112. conntrack \
  113. contextswitch \
  114. cpu \
  115. cpufreq \
  116. csv \
  117. curl \
  118. df \
  119. disk \
  120. dns \
  121. email \
  122. entropy \
  123. ethstat \
  124. exec \
  125. filecount \
  126. fscache \
  127. interface \
  128. iptables \
  129. irq \
  130. iwinfo \
  131. load \
  132. logfile \
  133. lua \
  134. match_empty_counter \
  135. match_hashed \
  136. match_regex \
  137. match_timediff \
  138. match_value \
  139. memory \
  140. modbus \
  141. mqtt \
  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. # collectd-mod-mysql needs iconv
  179. include $(INCLUDE_DIR)/nls.mk
  180. define Package/collectd/Default
  181. SECTION:=utils
  182. CATEGORY:=Utilities
  183. TITLE:=Lightweight system statistics collection daemon
  184. URL:=https://collectd.org/
  185. endef
  186. define Package/collectd
  187. $(call Package/collectd/Default)
  188. DEPENDS:= +libpthread \
  189. +zlib \
  190. +libltdl \
  191. +libip4tc \
  192. +PACKAGE_collectd-mod-lua:liblua
  193. MENU:=1
  194. endef
  195. define Package/collectd/description
  196. collectd is a small daemon which collects system information periodically
  197. and provides mechanismns to store the values in a variety of ways.
  198. endef
  199. define Package/collectd/config
  200. config PACKAGE_COLLECTD_ENCRYPTED_NETWORK
  201. bool "Enable ability to use encrypted networking"
  202. default n
  203. depends on PACKAGE_collectd
  204. select PACKAGE_collectd-mod-network
  205. endef
  206. # common configure args
  207. CONFIGURE_ARGS+= \
  208. --disable-werror \
  209. --disable-debug \
  210. --enable-daemon \
  211. --with-nan-emulation \
  212. --with-libyajl=no \
  213. --without-perl-bindings \
  214. --without-libudev
  215. CONFIGURE_VARS+= \
  216. CFLAGS="$$$$CFLAGS $(FPIC)" \
  217. LDFLAGS="$$$$LDFLAGS -lm -lz" \
  218. KERNEL_DIR="$(LINUX_DIR)"
  219. ifneq ($(CONFIG_PACKAGE_collectd-mod-lua),)
  220. CONFIGURE_VARS+= \
  221. LDFLAGS="$$$$LDFLAGS -llua"
  222. endif
  223. ifneq ($(CONFIG_PACKAGE_COLLECTD_ENCRYPTED_NETWORK),)
  224. CONFIGURE_ARGS+= \
  225. --with-libgcrypt=$(STAGING_DIR)/usr
  226. CONFIGURE_VARS+= \
  227. GCRYPT_LIBS="-lgcrypt"
  228. else
  229. CONFIGURE_ARGS+= \
  230. --without-libgcrypt
  231. endif
  232. CONFIGURE_PLUGIN= \
  233. $(foreach m, $(1), \
  234. $(if $(CONFIG_PACKAGE_collectd-mod-$(subst _,-,$(m))),--enable-$(m),--disable-$(m)) \
  235. )
  236. CONFIGURE_ARGS+= \
  237. $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_SELECTED)) \
  238. $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_DISABLED)) \
  239. # exception: mod-ascent needs libxml2
  240. ifneq ($(CONFIG_PACKAGE_collectd-mod-ascent),)
  241. CONFIGURE_VARS+= \
  242. CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/libxml2"
  243. endif
  244. ifneq ($(CONFIG_BIG_ENDIAN),)
  245. CONFIGURE_ARGS+= --with-fp-layout=endianflip
  246. else
  247. CONFIGURE_ARGS+= --with-fp-layout=nothing
  248. endif
  249. ifneq ($(CONFIG_PACKAGE_collectd-mod-postgresql),)
  250. CONFIGURE_ARGS+= --with-libpq="$(STAGING_DIR)/usr/"
  251. endif
  252. ifneq ($(CONFIG_PACKAGE_collectd-mod-mysql),)
  253. CONFIGURE_ARGS+= --with-libmysql="$(STAGING_DIR)/usr/"
  254. endif
  255. # exception: mod-netlink needs libnetlink from iproute
  256. ifneq ($(CONFIG_PACKAGE_collectd-mod-netlink),)
  257. CONFIGURE_ARGS+= --with-libnetlink="$(STAGING_DIR)/usr"
  258. endif
  259. # exception: mod-modbus needs libmodbus
  260. ifneq ($(CONFIG_PACKAGE_collectd-mod-modbus),)
  261. CONFIGURE_ARGS+= --with-libmodbus="$(STAGING_DIR)/usr"
  262. endif
  263. # exception: mod-onewire needs libow-capi
  264. ifneq ($(CONFIG_PACKAGE_collectd-mod-onewire),)
  265. CONFIGURE_ARGS+= --with-libowcapi="$(STAGING_DIR)/usr"
  266. endif
  267. # exception: mod-rrdtool needs rrdtool-1.0.x
  268. ifneq ($(CONFIG_PACKAGE_collectd-mod-rrdtool),)
  269. CONFIGURE_ARGS+= --with-librrd="$(STAGING_DIR)/usr/lib/rrdtool-1.0"
  270. endif
  271. define Package/collectd/conffiles
  272. /etc/collectd.conf
  273. endef
  274. define Package/collectd/install
  275. $(INSTALL_DIR) $(1)/usr/sbin
  276. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/collectd $(1)/usr/sbin/
  277. $(INSTALL_DIR) $(1)/usr/share/collectd
  278. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/collectd/types.db $(1)/usr/share/collectd/
  279. $(INSTALL_DIR) $(1)/etc
  280. $(INSTALL_CONF) ./files/collectd.conf $(1)/etc/
  281. $(INSTALL_DIR) $(1)/etc/init.d
  282. $(INSTALL_BIN) ./files/collectd.init $(1)/etc/init.d/collectd
  283. $(INSTALL_DIR) $(1)/etc/collectd/conf.d
  284. endef
  285. # 1: plugin name
  286. # 2: plugin title/description
  287. # 3: files
  288. # 4: extra dependency
  289. define BuildPlugin
  290. PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_collectd-mod-$(1)
  291. define Package/collectd-mod-$(1)
  292. $$(call Package/collectd/Default)
  293. TITLE:=$(2) plugin
  294. DEPENDS:= collectd $(4)
  295. endef
  296. define Package/collectd-mod-$(1)/install
  297. $(INSTALL_DIR) $$(1)/usr/lib/collectd
  298. for m in $(3); do \
  299. $(CP) \
  300. $(PKG_INSTALL_DIR)/usr/lib/collectd/$$$$$$$${m}.so \
  301. $$(1)/usr/lib/collectd/ ; \
  302. done
  303. endef
  304. $$(eval $$(call BuildPackage,collectd-mod-$(1)))
  305. endef
  306. $(eval $(call BuildPackage,collectd))
  307. #$(eval $(call BuildPlugin,NAME,DESCRIPTION,FILES,DEPENDENCIES))
  308. $(eval $(call BuildPlugin,apache,apache status input,apache,+PACKAGE_collectd-mod-apache:libcurl))
  309. $(eval $(call BuildPlugin,apcups,apcups status input,apcups,))
  310. $(eval $(call BuildPlugin,ascent,ascent status input,ascent,+PACKAGE_collectd-mod-ascent:libcurl +PACKAGE_collectd-mod-ascent:libxml2))
  311. $(eval $(call BuildPlugin,bind,BIND server/zone input,bind,+PACKAGE_collectd-mod-bind:libcurl +PACKAGE_collectd-mod-bind:libxml2))
  312. $(eval $(call BuildPlugin,chrony,chrony status input,chrony,))
  313. $(eval $(call BuildPlugin,conntrack,connection tracking table size input,conntrack,))
  314. $(eval $(call BuildPlugin,contextswitch,context switch input,contextswitch,))
  315. $(eval $(call BuildPlugin,cpu,CPU input,cpu,))
  316. $(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
  317. $(eval $(call BuildPlugin,csv,CSV output,csv,))
  318. $(eval $(call BuildPlugin,curl,cURL input,curl,+PACKAGE_collectd-mod-curl:libcurl))
  319. #$(eval $(call BuildPlugin,dbi,relational database input,dbi,+PACKAGE_collectd-mod-dbi:libdbi))
  320. $(eval $(call BuildPlugin,df,disk space input,df,))
  321. $(eval $(call BuildPlugin,disk,disk usage/timing input,disk,))
  322. $(eval $(call BuildPlugin,dns,DNS traffic input,dns,+PACKAGE_collectd-mod-dns:libpcap))
  323. $(eval $(call BuildPlugin,email,email output,email,))
  324. $(eval $(call BuildPlugin,entropy,Entropy amount input,entropy,))
  325. $(eval $(call BuildPlugin,ethstat,Ethernet adapter statistics input,ethstat,))
  326. $(eval $(call BuildPlugin,exec,process exec input,exec,))
  327. $(eval $(call BuildPlugin,filecount,file count input,filecount,))
  328. $(eval $(call BuildPlugin,fscache,file-system based caching framework input,fscache,))
  329. $(eval $(call BuildPlugin,interface,network interfaces input,interface,))
  330. $(eval $(call BuildPlugin,iptables,iptables status input,iptables,+PACKAGE_collectd-mod-iptables:iptables +libiptc))
  331. $(eval $(call BuildPlugin,irq,interrupt usage input,irq,))
  332. $(eval $(call BuildPlugin,iwinfo,libiwinfo wireless statistics,iwinfo,+PACKAGE_collectd-mod-iwinfo:libiwinfo))
  333. $(eval $(call BuildPlugin,load,system load input,load,))
  334. $(eval $(call BuildPlugin,logfile,log files output,logfile,))
  335. $(eval $(call BuildPlugin,lua,lua input/output,lua,+PACKAGE_collectd-mod-lua:liblua))
  336. $(eval $(call BuildPlugin,match-empty-counter,empty-counter match,match_empty_counter,))
  337. $(eval $(call BuildPlugin,match-hashed,hashed match,match_hashed,))
  338. $(eval $(call BuildPlugin,match-regex,regex match,match_regex,))
  339. $(eval $(call BuildPlugin,match-timediff,timediff match,match_timediff,))
  340. $(eval $(call BuildPlugin,match-value,value match,match_value,))
  341. $(eval $(call BuildPlugin,mysql,MySQL status input,mysql,+PACKAGE_collectd-mod-mysql:libmysqlclient-r))
  342. $(eval $(call BuildPlugin,memory,physical memory usage input,memory,))
  343. $(eval $(call BuildPlugin,modbus,read variables through libmodbus,modbus,+PACKAGE_collectd-mod-modbus:libmodbus))
  344. $(eval $(call BuildPlugin,mqtt,transmit data with MQTT,mqtt,+PACKAGE_collectd-mod-mqtt:libmosquitto))
  345. $(eval $(call BuildPlugin,netlink,netlink input,netlink,+PACKAGE_collectd-mod-netlink:libmnl))
  346. $(eval $(call BuildPlugin,network,network input/output,network,+PACKAGE_COLLECTD_ENCRYPTED_NETWORK:libgcrypt))
  347. $(eval $(call BuildPlugin,nginx,nginx status input,nginx,+PACKAGE_collectd-mod-nginx:libcurl))
  348. $(eval $(call BuildPlugin,ntpd,NTP daemon status input,ntpd,))
  349. $(eval $(call BuildPlugin,nut,UPS monitoring input,nut,+PACKAGE_collectd-mod-nut:nut-common))
  350. $(eval $(call BuildPlugin,olsrd,OLSRd status input,olsrd,))
  351. $(eval $(call BuildPlugin,onewire,onewire sensor input,onewire,+PACKAGE_collectd-mod-onewire:libow-capi @BROKEN))
  352. $(eval $(call BuildPlugin,openvpn,OpenVPN traffic/compression input,openvpn,))
  353. $(eval $(call BuildPlugin,ping,ping status input,ping,+PACKAGE_collectd-mod-ping:liboping))
  354. $(eval $(call BuildPlugin,postgresql,PostgreSQL status input,postgresql,+PACKAGE_collectd-mod-postgresql:libpq))
  355. $(eval $(call BuildPlugin,powerdns,PowerDNS server status input,powerdns,))
  356. $(eval $(call BuildPlugin,processes,process status input,processes,))
  357. $(eval $(call BuildPlugin,protocols,network protocols input,protocols,))
  358. $(eval $(call BuildPlugin,rrdtool,RRDtool output,rrdtool,+PACKAGE_collectd-mod-rrdtool:librrd1))
  359. $(eval $(call BuildPlugin,sensors,lm_sensors input,sensors,+PACKAGE_collectd-mod-sensors:libsensors))
  360. $(eval $(call BuildPlugin,snmp,SNMP input,snmp,+PACKAGE_collectd-mod-snmp:libnetsnmp))
  361. $(eval $(call BuildPlugin,syslog,syslog output,syslog,))
  362. $(eval $(call BuildPlugin,tail,tail input,tail,))
  363. $(eval $(call BuildPlugin,tail-csv,tail CSV input,tail_csv,))
  364. $(eval $(call BuildPlugin,table,table-like structured file input,table,))
  365. $(eval $(call BuildPlugin,teamspeak2,TeamSpeak2 input,teamspeak2,))
  366. $(eval $(call BuildPlugin,ted,The Energy Detective input,ted,))
  367. $(eval $(call BuildPlugin,tcpconns,TCP connection tracking input,tcpconns,))
  368. $(eval $(call BuildPlugin,thermal,system temperatures input,thermal,))
  369. $(eval $(call BuildPlugin,unixsock,unix socket output,unixsock,))
  370. $(eval $(call BuildPlugin,uptime,uptime status input,uptime,))
  371. $(eval $(call BuildPlugin,users,user logged in status input,users,))
  372. $(eval $(call BuildPlugin,vmem,virtual memory usage input,vmem,))
  373. $(eval $(call BuildPlugin,wireless,wireless status input,wireless,))
  374. $(eval $(call BuildPlugin,write-graphite,Carbon/Graphite output,write_graphite,+PACKAGE_collectd-mod-write-graphite:libpthread))
  375. $(eval $(call BuildPlugin,write-http,HTTP POST output,write_http,+PACKAGE_collectd-mod-write-http:libcurl))