diff options
author | Marko Ratkaj <marko.ratkaj@sartura.hr> | 2015-06-02 15:15:08 +0200 |
---|---|---|
committer | Luka Perkov <luka@openwrt.org> | 2015-06-08 11:46:17 +0200 |
commit | 08631d9c8f197fadb184efe6ce3cfcd340dc9514 (patch) | |
tree | 85dad343b89b3f275bae481a3bf25f2a2297978c /utils/sysstat/files | |
parent | 433a621c42f0658802929006c2a39811656bc78b (diff) |
sysstat: import from old packages
Signed-off-by: Marko Ratkaj <marko.ratkaj@sartura.hr>
Diffstat (limited to 'utils/sysstat/files')
-rw-r--r-- | utils/sysstat/files/sysstat.config | 7 | ||||
-rwxr-xr-x | utils/sysstat/files/sysstat.init | 49 |
2 files changed, 56 insertions, 0 deletions
diff --git a/utils/sysstat/files/sysstat.config b/utils/sysstat/files/sysstat.config new file mode 100644 index 000000000..638b3798c --- /dev/null +++ b/utils/sysstat/files/sysstat.config @@ -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 index 000000000..a8190008d --- /dev/null +++ b/utils/sysstat/files/sysstat.init @@ -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 +} |