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.

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