Verified Commit 8a032dfd authored by Štěpán Henek's avatar Štěpán Henek 🌩

follectd: program which collects stat data for foris added

parent 562c0d4d
#
## Copyright (C) 2019 CZ.NIC z.s.p.o. (http://www.nic.cz/)
#
## This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
# #
#
include $(TOPDIR)/rules.mk
PKG_NAME:=follectd
PKG_VERSION:=1
PKG_MAINTAINER:=CZ.NIC <packaging@turris.cz>
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
TITLE:=$(PKG_NAME)
DEPENDS:=\
+collectd \
+collectd-mod-cpu \
+collectd-mod-disk \
+collectd-mod-exec \
+collectd-mod-interface \
+collectd-mod-memory \
+collectd-mod-unixsock \
USERID:=follect=268:follect=268
endef
define Package/$(PKG_NAME)/description
Instance of collectd server used as data source for foris-controller-collectd-module
endef
# The built is empty. But as there's no makefile in the git repo, we need to
# override the default that runs "make".
define Build/Compile
true
endef
define Package/$(PKG_NAME)/conffiles
/etc/follectd.conf
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/follectd.init $(1)/etc/init.d/follectd
$(INSTALL_DIR) $(1)/usr/libexec/follect/
$(INSTALL_BIN) ./files/neighbours.sh $(1)/usr/libexec/follect/neighbours.sh
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/follectd.conf $(1)/etc/follectd.conf
endef
define Package/$(PKG_NAME)/postinst
#!/bin/sh
[ -n "$${IPKG_INSTROOT}" ] || {
# run scripts to update files
/etc/init.d/follectd enable
/etc/init.d/follectd restart
}
endef
$(eval $(call BuildPackage,$(PKG_NAME)))
BaseDir "/var/lib/follectd"
PIDFile "/var/run/follectd.pid"
Interval 5
ReadThreads 1
WriteThreads 1
LoadPlugin cpu
LoadPlugin df
LoadPlugin exec
LoadPlugin interface
LoadPlugin memory
LoadPlugin network
LoadPlugin unixsock
<Plugin cpu>
ReportByState false
ReportByCpu true
</Plugin>
<Plugin df>
ValuesAbsolute true
ValuesPercentage false
ReportByDevice true
</Plugin>
<Plugin interface>
Interface "lo"
Interface "/^ifb.*/"
Interface "/^gre.*/"
Interface "/^teql.*/"
IgnoreSelected true
</Plugin>
<Plugin memory>
ValuesAbsolute true
ValuesPercentage false
</Plugin>
<Plugin unixsock>
SocketFile "/var/run/follectd.sock"
SocketGroup "root"
SocketPerms "0770"
DeleteSocket true
</Plugin>
<Plugin exec>
Exec "root" "/usr/libexec/follectd/neighbours.sh"
</Plugin>
#!/bin/sh /etc/rc.common
START=50
STOP=50
USE_PROCD=1
start_service() {
procd_open_instance
procd_set_param command collectd
procd_append_param command -C /etc/follectd.conf -f
procd_set_param stdout 1 # forward stdout of the command to logd
procd_set_param stderr 1 # same for stderr
procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-0.2} ${respawn_retry:-25}
procd_close_instance
}
HOSTNAME="${COLLECTD_HOSTNAME:-localhost}"
INTERVAL="${COLLECTD_INTERVAL:-60}"
VALUE="$(ip n | wc -l)"
echo "PUTVAL \"$HOSTNAME/exec-neighbours/gauge-neighbours\" interval=$INTERVAL N:$VALUE"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment