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.

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