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.

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