sysstat: import from old packages
authorMarko Ratkaj <marko.ratkaj@sartura.hr>
Tue, 2 Jun 2015 13:15:08 +0000 (15:15 +0200)
committerLuka Perkov <luka@openwrt.org>
Mon, 8 Jun 2015 09:46:17 +0000 (11:46 +0200)
Signed-off-by: Marko Ratkaj <marko.ratkaj@sartura.hr>
utils/sysstat/Makefile [new file with mode: 0644]
utils/sysstat/files/sysstat.config [new file with mode: 0644]
utils/sysstat/files/sysstat.init [new file with mode: 0755]

diff --git a/utils/sysstat/Makefile b/utils/sysstat/Makefile
new file mode 100644 (file)
index 0000000..f1f129d
--- /dev/null
@@ -0,0 +1,65 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=sysstat
+PKG_VERSION:=11.0.4
+PKG_RELEASE:=1
+
+PKG_MAINTAINER:=Marko Ratkaj <marko.ratkaj@sartura.hr>
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=http://perso.orange.fr/sebastien.godard/
+PKG_MD5SUM:=df1ed75656eb06320088d54247f0e803
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/sysstat
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Sysstat performance monitoring tools
+  URL:=http://pagesperso-orange.fr/sebastien.godard/index.html
+endef
+
+define Package/sysstat/description
+ The sysstat utilities are a collection of performance monitoring tools for
+ Linux. These include sar, sadf, mpstat, iostat, pidstat and sa tools.
+endef
+
+define Package/sysstat/conffiles
+/etc/sysstat/sysstat.ioconf
+/etc/sysstat/sysstat
+endef
+
+CONFIGURE_VARS+= \
+       sa_lib_dir="/usr/lib/sysstat" \
+       sa_dir="/var/log/sysstat" \
+       conf_dir="/etc/sysstat"
+
+CONFIGURE_ARGS+= \
+       --disable-documentation \
+       --disable-largefile \
+       --disable-sensors \
+       --disable-nls
+
+define Package/sysstat/install
+       $(INSTALL_DIR) $(1)/usr/lib/sysstat
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/sysstat/{sadc,sa1,sa2} $(1)/usr/lib/sysstat/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{sar,sadf,iostat,mpstat,pidstat} $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc/sysstat
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/sysstat/sysstat.ioconf $(1)/etc/sysstat/
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) ./files/sysstat.config $(1)/etc/config/sysstat
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/sysstat.init $(1)/etc/init.d/sysstat
+endef
+
+$(eval $(call BuildPackage,sysstat))
diff --git a/utils/sysstat/files/sysstat.config b/utils/sysstat/files/sysstat.config
new file mode 100644 (file)
index 0000000..638b379
--- /dev/null
@@ -0,0 +1,7 @@
+config sysstat 'sysstat'
+       option log_history '7'
+       option compressafter '10'
+       option sadc_options ''
+       option sa_dir '/var/log/sysstat'
+       option zip 'xz'
+       option enabled 'true'
diff --git a/utils/sysstat/files/sysstat.init b/utils/sysstat/files/sysstat.init
new file mode 100755 (executable)
index 0000000..a819000
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2015 OpenWrt.org
+
+START=90
+STOP=10
+
+USE_PROCD=1
+PROG=/usr/lib/sysstat/sadc
+SYSSTAT_CFG="/etc/sysstat/sysstat"
+
+validate_sysstat_section() {
+       uci_validate_section sysstat sysstat "${1}" \
+               'log_history:uinteger' \
+               'compressafter:uinteger' \
+               'sadc_options:string' \
+               'sa_dir:string' \
+               'zip:string' \
+               'enabled:string'
+}
+
+start_service() {
+
+       local log_history compressafter sadc_options sa_dir zip enabled
+
+       validate_sysstat_section sysstat || {
+               echo "validation failed"
+               return 1
+       }
+
+       [ -d /var/log/sysstat ] || mkdir -p /var/log/sysstat
+
+       echo "HISTORY=$log_history" > $SYSSTAT_CFG
+       echo "COMPRESSAFTER=$compressafter" >> $SYSSTAT_CFG
+       echo "SADC_OPTIONS=\"$sadc_options\"" >> $SYSSTAT_CFG
+       echo "SA_DIR=\"$sa_dir\"" >> $SYSSTAT_CFG
+       echo "ZIP=\"$zip\"" >> $SYSSTAT_CFG
+       echo "ENABLED=\"$enabled\"" >> $SYSSTAT_CFG
+
+       procd_open_instance
+       procd_set_param command $PROG -S DISK -F -L -
+       procd_set_param file $SYSSTAT_CFG
+       procd_close_instance
+}
+
+service_triggers()
+{
+       procd_add_reload_trigger "sysstat"
+       procd_add_validation validate_sysstat_section
+}