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.

471 lines
14 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:=2
  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. dhcpleases \
  141. disk \
  142. dns \
  143. email \
  144. entropy \
  145. ethstat \
  146. exec \
  147. filecount \
  148. fscache \
  149. interface \
  150. iptables \
  151. irq \
  152. iwinfo \
  153. load \
  154. logfile \
  155. lua \
  156. match_empty_counter \
  157. match_hashed \
  158. match_regex \
  159. match_timediff \
  160. match_value \
  161. memory \
  162. modbus \
  163. mqtt \
  164. mysql \
  165. netlink \
  166. network \
  167. nginx \
  168. ntpd \
  169. nut \
  170. olsrd \
  171. openvpn \
  172. ping \
  173. postgresql \
  174. powerdns \
  175. processes \
  176. protocols \
  177. routeros \
  178. rrdtool \
  179. sensors \
  180. snmp \
  181. syslog \
  182. table \
  183. tail \
  184. tail_csv \
  185. tcpconns \
  186. teamspeak2 \
  187. ted \
  188. thermal \
  189. threshold \
  190. ubi \
  191. unixsock \
  192. uptime \
  193. users \
  194. vmem \
  195. wireless \
  196. write_graphite \
  197. write_http \
  198. PKG_CONFIG_DEPENDS:= \
  199. $(patsubst %,CONFIG_PACKAGE_collectd-mod-%,$(subst _,-,$(COLLECTD_PLUGINS_SELECTED))) \
  200. include $(INCLUDE_DIR)/package.mk
  201. include $(INCLUDE_DIR)/kernel.mk
  202. # collectd-mod-mysql needs iconv
  203. include $(INCLUDE_DIR)/nls.mk
  204. define Package/collectd/Default
  205. SECTION:=utils
  206. CATEGORY:=Utilities
  207. TITLE:=Lightweight system statistics collection daemon
  208. URL:=https://collectd.org/
  209. endef
  210. define Package/collectd
  211. $(call Package/collectd/Default)
  212. DEPENDS:= +libpthread \
  213. +zlib \
  214. +libltdl \
  215. +libip4tc \
  216. +jshn \
  217. +PACKAGE_collectd-mod-lua:liblua
  218. MENU:=1
  219. endef
  220. define Package/collectd/description
  221. collectd is a small daemon which collects system information periodically
  222. and provides mechanismns to store the values in a variety of ways.
  223. endef
  224. define Package/collectd/config
  225. config PACKAGE_COLLECTD_ENCRYPTED_NETWORK
  226. bool "Enable ability to use encrypted networking"
  227. default n
  228. depends on PACKAGE_collectd
  229. select PACKAGE_collectd-mod-network
  230. endef
  231. # common configure args
  232. CONFIGURE_ARGS+= \
  233. --disable-werror \
  234. --disable-debug \
  235. --enable-daemon \
  236. --with-nan-emulation \
  237. --with-libyajl=no \
  238. --without-perl-bindings \
  239. --without-libudev
  240. CONFIGURE_VARS+= \
  241. CFLAGS="$$$$CFLAGS $(FPIC)" \
  242. LDFLAGS="$$$$LDFLAGS -lm -lz" \
  243. KERNEL_DIR="$(LINUX_DIR)"
  244. ifneq ($(CONFIG_PACKAGE_collectd-mod-lua),)
  245. CONFIGURE_VARS+= \
  246. LDFLAGS="$$$$LDFLAGS -llua"
  247. endif
  248. ifneq ($(CONFIG_PACKAGE_COLLECTD_ENCRYPTED_NETWORK),)
  249. CONFIGURE_ARGS+= \
  250. --with-libgcrypt=$(STAGING_DIR)/usr
  251. CONFIGURE_VARS+= \
  252. GCRYPT_LIBS="-lgcrypt"
  253. else
  254. CONFIGURE_ARGS+= \
  255. --without-libgcrypt
  256. endif
  257. CONFIGURE_PLUGIN= \
  258. $(foreach m, $(1), \
  259. $(if $(CONFIG_PACKAGE_collectd-mod-$(subst _,-,$(m))),--enable-$(m),--disable-$(m)) \
  260. )
  261. CONFIGURE_ARGS+= \
  262. $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_SELECTED)) \
  263. $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_DISABLED)) \
  264. # exception: mod-ascent needs libxml2
  265. ifneq ($(CONFIG_PACKAGE_collectd-mod-ascent),)
  266. CONFIGURE_VARS+= \
  267. CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/libxml2"
  268. endif
  269. ifneq ($(CONFIG_BIG_ENDIAN),)
  270. CONFIGURE_ARGS+= --with-fp-layout=endianflip
  271. else
  272. CONFIGURE_ARGS+= --with-fp-layout=nothing
  273. endif
  274. ifneq ($(CONFIG_PACKAGE_collectd-mod-postgresql),)
  275. CONFIGURE_ARGS+= --with-libpq="$(STAGING_DIR)/usr/"
  276. endif
  277. ifneq ($(CONFIG_PACKAGE_collectd-mod-mysql),)
  278. CONFIGURE_ARGS+= --with-libmysql="$(STAGING_DIR)/usr/"
  279. endif
  280. # exception: mod-netlink needs libnetlink from iproute
  281. ifneq ($(CONFIG_PACKAGE_collectd-mod-netlink),)
  282. CONFIGURE_ARGS+= --with-libnetlink="$(STAGING_DIR)/usr"
  283. endif
  284. # exception: mod-modbus needs libmodbus
  285. ifneq ($(CONFIG_PACKAGE_collectd-mod-modbus),)
  286. CONFIGURE_ARGS+= --with-libmodbus="$(STAGING_DIR)/usr"
  287. endif
  288. # exception: mod-rrdtool needs rrdtool-1.0.x
  289. ifneq ($(CONFIG_PACKAGE_collectd-mod-rrdtool),)
  290. CONFIGURE_ARGS+= --with-librrd="$(STAGING_DIR)/usr/lib/rrdtool-1.0"
  291. endif
  292. define Package/collectd/conffiles
  293. /etc/collectd.conf
  294. /etc/config/collectd
  295. endef
  296. define Package/collectd/install
  297. $(INSTALL_DIR) $(1)/usr/sbin
  298. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/collectd $(1)/usr/sbin/
  299. $(INSTALL_DIR) $(1)/usr/share/collectd
  300. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/collectd/types.db $(1)/usr/share/collectd/
  301. $(INSTALL_DIR) $(1)/etc/init.d
  302. $(INSTALL_BIN) ./files/collectd.init $(1)/etc/init.d/collectd
  303. $(INSTALL_DIR) $(1)/etc/config
  304. $(INSTALL_CONF) files/collectd.uci $(1)/etc/config/collectd
  305. endef
  306. # 1: plugin name
  307. # 2: plugin title/description
  308. # 3: files
  309. # 4: extra dependency
  310. define BuildPlugin
  311. PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_collectd-mod-$(1)
  312. define Package/collectd-mod-$(1)
  313. $$(call Package/collectd/Default)
  314. TITLE:=$(2) plugin
  315. DEPENDS:= collectd $(4)
  316. endef
  317. define Package/collectd-mod-$(1)/install
  318. $(INSTALL_DIR) $$(1)/usr/lib/collectd
  319. for m in $(3); do \
  320. $(CP) \
  321. $(PKG_INSTALL_DIR)/usr/lib/collectd/$$$$$$$${m}.so \
  322. $$(1)/usr/lib/collectd/ ; \
  323. done
  324. if [ -f ./files/usr/share/collectd/plugin/$(1).json ]; then \
  325. $(INSTALL_DIR) $$(1)/usr/share/collectd/plugin ; \
  326. $(INSTALL_DATA) ./files/usr/share/collectd/plugin/$(1).json \
  327. $$(1)/usr/share/collectd/plugin/$(1).json ; \
  328. fi
  329. endef
  330. $$(eval $$(call BuildPackage,collectd-mod-$(1)))
  331. endef
  332. define BuildScriptPlugin
  333. PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_collectd-mod-$(1)
  334. define Package/collectd-mod-$(1)
  335. $$(call Package/collectd/Default)
  336. TITLE:=$(2) plugin
  337. DEPENDS:= $(4)
  338. endef
  339. define Package/collectd-mod-$(1)/install
  340. $(INSTALL_DIR) $$(1)/usr/libexec/collectd
  341. for m in $(3); do \
  342. ${INSTALL_BIN} \
  343. ./files/exec-scripts/$$$$$$$${m}.sh $$(1)/usr/libexec/collectd/ ; \
  344. done
  345. if [ -f ./files/usr/share/collectd/plugin/$(1).json ]; then \
  346. $(INSTALL_DIR) $$(1)/usr/share/collectd/plugin ; \
  347. $(INSTALL_DATA) ./files/usr/share/collectd/plugin/$(1).json \
  348. $$(1)/usr/share/collectd/plugin/$(1).json ; \
  349. fi
  350. endef
  351. $$(eval $$(call BuildPackage,collectd-mod-$(1)))
  352. endef
  353. $(eval $(call BuildPackage,collectd))
  354. #$(eval $(call BuildPlugin,NAME,DESCRIPTION,FILES,DEPENDENCIES))
  355. $(eval $(call BuildPlugin,apache,apache status input,apache,+PACKAGE_collectd-mod-apache:libcurl))
  356. $(eval $(call BuildPlugin,apcups,apcups status input,apcups,))
  357. $(eval $(call BuildPlugin,ascent,ascent status input,ascent,+PACKAGE_collectd-mod-ascent:libcurl +PACKAGE_collectd-mod-ascent:libxml2))
  358. $(eval $(call BuildPlugin,bind,BIND server/zone input,bind,+PACKAGE_collectd-mod-bind:libcurl +PACKAGE_collectd-mod-bind:libxml2))
  359. $(eval $(call BuildPlugin,chrony,chrony status input,chrony,))
  360. $(eval $(call BuildPlugin,conntrack,connection tracking table size input,conntrack,))
  361. $(eval $(call BuildPlugin,contextswitch,context switch input,contextswitch,))
  362. $(eval $(call BuildPlugin,cpu,CPU input,cpu,))
  363. $(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
  364. $(eval $(call BuildPlugin,csv,CSV output,csv,))
  365. $(eval $(call BuildPlugin,curl,cURL input,curl,+PACKAGE_collectd-mod-curl:libcurl))
  366. #$(eval $(call BuildPlugin,dbi,relational database input,dbi,+PACKAGE_collectd-mod-dbi:libdbi))
  367. $(eval $(call BuildPlugin,df,disk space input,df,))
  368. $(eval $(call BuildPlugin,dhcpleases,show dhcpleases,dhcpleases,))
  369. $(eval $(call BuildPlugin,disk,disk usage/timing input,disk,))
  370. $(eval $(call BuildPlugin,dns,DNS traffic input,dns,+PACKAGE_collectd-mod-dns:libpcap))
  371. $(eval $(call BuildPlugin,email,email output,email,))
  372. $(eval $(call BuildPlugin,entropy,Entropy amount input,entropy,))
  373. $(eval $(call BuildPlugin,ethstat,Ethernet adapter statistics input,ethstat,))
  374. $(eval $(call BuildPlugin,exec,process exec input,exec,))
  375. $(eval $(call BuildPlugin,filecount,file count input,filecount,))
  376. $(eval $(call BuildPlugin,fscache,file-system based caching framework input,fscache,))
  377. $(eval $(call BuildPlugin,interface,network interfaces input,interface,))
  378. $(eval $(call BuildPlugin,iptables,iptables status input,iptables,+PACKAGE_collectd-mod-iptables:iptables +libip4tc +libip6tc))
  379. $(eval $(call BuildPlugin,irq,interrupt usage input,irq,))
  380. $(eval $(call BuildPlugin,iwinfo,libiwinfo wireless statistics,iwinfo,+PACKAGE_collectd-mod-iwinfo:libiwinfo))
  381. $(eval $(call BuildPlugin,load,system load input,load,))
  382. $(eval $(call BuildPlugin,logfile,log files output,logfile,))
  383. $(eval $(call BuildPlugin,lua,lua input/output,lua,+PACKAGE_collectd-mod-lua:liblua))
  384. $(eval $(call BuildPlugin,match-empty-counter,empty-counter match,match_empty_counter,))
  385. $(eval $(call BuildPlugin,match-hashed,hashed match,match_hashed,))
  386. $(eval $(call BuildPlugin,match-regex,regex match,match_regex,))
  387. $(eval $(call BuildPlugin,match-timediff,timediff match,match_timediff,))
  388. $(eval $(call BuildPlugin,match-value,value match,match_value,))
  389. $(eval $(call BuildPlugin,mysql,MySQL status input,mysql,+PACKAGE_collectd-mod-mysql:libmysqlclient-r))
  390. $(eval $(call BuildPlugin,memory,physical memory usage input,memory,))
  391. $(eval $(call BuildPlugin,modbus,read variables through libmodbus,modbus,+PACKAGE_collectd-mod-modbus:libmodbus))
  392. $(eval $(call BuildPlugin,mqtt,transmit data with MQTT,mqtt,+PACKAGE_collectd-mod-mqtt:libmosquitto))
  393. $(eval $(call BuildPlugin,netlink,netlink input,netlink,+PACKAGE_collectd-mod-netlink:libmnl))
  394. $(eval $(call BuildPlugin,network,network input/output,network,+PACKAGE_COLLECTD_ENCRYPTED_NETWORK:libgcrypt))
  395. $(eval $(call BuildPlugin,nginx,nginx status input,nginx,+PACKAGE_collectd-mod-nginx:libcurl))
  396. $(eval $(call BuildPlugin,ntpd,NTP daemon status input,ntpd,))
  397. $(eval $(call BuildPlugin,nut,UPS monitoring input,nut,+PACKAGE_collectd-mod-nut:nut-common))
  398. $(eval $(call BuildPlugin,olsrd,OLSRd status input,olsrd,))
  399. $(eval $(call BuildPlugin,openvpn,OpenVPN traffic/compression input,openvpn,))
  400. $(eval $(call BuildPlugin,ping,ping status input,ping,+PACKAGE_collectd-mod-ping:liboping))
  401. $(eval $(call BuildPlugin,postgresql,PostgreSQL status input,postgresql,+PACKAGE_collectd-mod-postgresql:libpq))
  402. $(eval $(call BuildPlugin,powerdns,PowerDNS server status input,powerdns,))
  403. $(eval $(call BuildPlugin,processes,process status input,processes,+PACKAGE_collectd-mod-processes:libmnl))
  404. $(eval $(call BuildPlugin,protocols,network protocols input,protocols,))
  405. $(eval $(call BuildPlugin,routeros,MikroTik RouterOS input,routeros,+PACKAGE_collectd-mod-routeros:librouteros))
  406. $(eval $(call BuildPlugin,rrdtool,RRDtool output,rrdtool,+PACKAGE_collectd-mod-rrdtool:librrd1))
  407. $(eval $(call BuildPlugin,sensors,lm_sensors input,sensors,+PACKAGE_collectd-mod-sensors:libsensors))
  408. $(eval $(call BuildPlugin,snmp,SNMP input,snmp,+PACKAGE_collectd-mod-snmp:libnetsnmp))
  409. $(eval $(call BuildPlugin,syslog,syslog output,syslog,))
  410. $(eval $(call BuildPlugin,tail,tail input,tail,))
  411. $(eval $(call BuildPlugin,tail-csv,tail CSV input,tail_csv,))
  412. $(eval $(call BuildPlugin,table,table-like structured file input,table,))
  413. $(eval $(call BuildPlugin,teamspeak2,TeamSpeak2 input,teamspeak2,))
  414. $(eval $(call BuildPlugin,ted,The Energy Detective input,ted,))
  415. $(eval $(call BuildPlugin,tcpconns,TCP connection tracking input,tcpconns,))
  416. $(eval $(call BuildPlugin,thermal,system temperatures input,thermal,))
  417. $(eval $(call BuildPlugin,threshold,Notifications and thresholds,threshold,))
  418. $(eval $(call BuildPlugin,ubi,Unsorted block images,ubi,@NAND_SUPPORT))
  419. $(eval $(call BuildPlugin,unixsock,unix socket output,unixsock,))
  420. $(eval $(call BuildPlugin,uptime,uptime status input,uptime,))
  421. $(eval $(call BuildPlugin,users,user logged in status input,users,))
  422. $(eval $(call BuildPlugin,vmem,virtual memory usage input,vmem,))
  423. $(eval $(call BuildPlugin,wireless,wireless status input,wireless,))
  424. $(eval $(call BuildPlugin,write-graphite,Carbon/Graphite output,write_graphite,+PACKAGE_collectd-mod-write-graphite:libpthread))
  425. $(eval $(call BuildPlugin,write-http,HTTP POST output,write_http,+PACKAGE_collectd-mod-write-http:libcurl))
  426. $(eval $(call BuildScriptPlugin,sqm,SQM/qdisc collection,sqm_collectd,+PACKAGE_collectd-mod-sqm:collectd-mod-exec))