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.

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