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.

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