diff options
Diffstat (limited to 'applications/luci-app-statistics/root/etc')
3 files changed, 212 insertions, 0 deletions
diff --git a/applications/luci-app-statistics/root/etc/config/luci_statistics b/applications/luci-app-statistics/root/etc/config/luci_statistics new file mode 100644 index 0000000000..e39db3513a --- /dev/null +++ b/applications/luci-app-statistics/root/etc/config/luci_statistics @@ -0,0 +1,143 @@ +config 'statistics' 'rrdtool' + option 'default_timespan' '1hour' + option 'image_width' '600' + option 'image_path' '/tmp/rrdimg' + +config 'statistics' 'collectd' + option 'BaseDir' '/var/run/collectd' + option 'Include' '/etc/collectd/conf.d' + option 'PIDFile' '/var/run/collectd.pid' + option 'PluginDir' '/usr/lib/collectd' + option 'TypesDB' '/usr/share/collectd/types.db' + option 'Interval' '30' + option 'ReadThreads' '2' + +config 'statistics' 'collectd_ping' + option 'enable' '0' + option 'TTL' '127' + option 'Interval' '30' + option 'Hosts' '127.0.0.1' + +config 'statistics' 'collectd_csv' + option 'enable' '0' + option 'StoreRates' '0' + option 'DataDir' '/tmp' + +config 'statistics' 'collectd_df' + option 'enable' '0' + option 'Devices' '/dev/mtdblock/4' + option 'MountPoints' '/jffs' + option 'FSTypes' 'tmpfs' + option 'IgnoreSelected' '0' + +config 'statistics' 'collectd_disk' + option 'enable' '0' + option 'Disks' 'hda1 hdb' + option 'IgnoreSelected' '0' + +config 'statistics' 'collectd_dns' + option 'enable' '0' + option 'Interfaces' 'ffdhcp ff br-lan' + option 'IgnoreSources' '127.0.0.1' + +config 'statistics' 'collectd_email' + option 'enable' '0' + option 'SocketFile' '/var/run/collectd/email.sock' + option 'SocketGroup' 'nogroup' + +config 'statistics' 'collectd_exec' + option 'enable' '0' + +config 'statistics' 'collectd_interface' + option 'enable' '1' + option 'Interfaces' 'br-lan br-ff' + option 'IgnoreSelected' '0' + +config 'statistics' 'collectd_iptables' + option 'enable' '1' + +config 'collectd_iptables_match' + option 'table' 'nat' + option 'chain' 'luci_fw_postrouting' + option 'target' 'MASQUERADE' + option 'source' '192.168.1.0/24' + option 'outputif' 'br-ff' + option 'name' 'Verkehr LAN-Clients' + +config 'collectd_iptables_match' + option 'chain' 'luci_fw_postrouting' + option 'table' 'nat' + option 'target' 'MASQUERADE' + option 'source' '10.61.230.0/24' + option 'outputif' 'br-ff' + option 'name' 'Verkehr WLAN-Clients' + +config 'statistics' 'collectd_irq' + option 'enable' '0' + option 'Irqs' '2 3 4 7' + +config 'statistics' 'collectd_load' + option 'enable' '1' + +config 'statistics' 'collectd_logfile' + option 'enable' '0' + option 'LogLevel' 'notice' + option 'File' '/var/log/collectd.log' + option 'Timestamp' '1' + +config 'statistics' 'collectd_netlink' + option 'enable' '0' + option 'IgnoreSelected' '0' + option 'VerboseInterfaces' 'br-lan br-ff' + option 'QDiscs' 'br-lan br-ff' + +config 'statistics' 'collectd_network' + option 'enable' '0' + +config 'statistics' 'collectd_processes' + option 'enable' '1' + option 'Processes' 'uhttpd dnsmasq dropbear' + +config statistics 'collectd_splash_leases' + option enable '1' + +config 'statistics' 'collectd_tcpconns' + option 'enable' '1' + option 'ListeningPorts' '0' + option 'LocalPorts' '22 80' + +config 'statistics' 'collectd_unixsock' + option 'enable' '0' + option 'SocketFile' '/var/run/collectd/query.sock' + option 'SocketGroup' 'nogroup' + +config 'statistics' 'collectd_cpu' + option 'enable' '1' + +config 'statistics' 'collectd_rrdtool' + option 'enable' '1' + option 'DataDir' '/tmp/rrd' + option 'RRARows' '100' + option 'RRASingle' '1' + option 'RRATimespans' '1hour 1day 1week 1month 1year' + +config 'statistics' 'collectd_memory' + option 'enable' '1' + +config 'statistics' 'collectd_conntrack' + option 'enable' '1' + +config 'statistics' 'collectd_olsrd' + option 'enable' '1' + option 'Port' '2006' + option 'Host' '127.0.0.1' + +config 'statistics' 'collectd_iwinfo' + option 'enable' '1' + +config 'statistics' 'collectd_nut' + option 'enable' '0' + option 'UPS' 'myupsname' + +config 'statistics' 'collectd_uptime' + option 'enable' '1' diff --git a/applications/luci-app-statistics/root/etc/init.d/luci_statistics b/applications/luci-app-statistics/root/etc/init.d/luci_statistics new file mode 100755 index 0000000000..936f3a63c3 --- /dev/null +++ b/applications/luci-app-statistics/root/etc/init.d/luci_statistics @@ -0,0 +1,33 @@ +#!/bin/sh /etc/rc.common +START=79 + +start() { + ### replace shipped config with symlink + if [ ! -L /etc/collectd.conf ]; then + test -f /etc/collectd.conf && mv /etc/collectd.conf /etc/collectd.conf.bak + ln -s /var/etc/collectd.conf /etc/collectd.conf + fi + + ### create config + mkdir -p /var/etc + /usr/bin/stat-genconfig > /var/etc/collectd.conf + + ### prepare rrdimg directory + if [ -f /etc/config/lucid ] && [ -x /etc/init.d/lucid ] && /etc/init.d/lucid enabled && \ + [ "$(uci get luci_statistics.rrdtool.image_path 2>/dev/null)" != "$(uci get lucid.statistics.physical 2>/dev/null)" ]; then + uci set lucid.statistics.physical=$(uci get luci_statistics.rrdtool.image_path) + uci commit lucid + /etc/init.d/lucid restart + fi + + ### workaround broken permissions on /tmp + chmod 1777 /tmp +} + +restart() { + ### regenerate config / prepare environment + start + + ### restart collectd + /etc/init.d/collectd restart +} diff --git a/applications/luci-app-statistics/root/etc/uci-defaults/luci-statistics b/applications/luci-app-statistics/root/etc/uci-defaults/luci-statistics new file mode 100755 index 0000000000..e94a8637c8 --- /dev/null +++ b/applications/luci-app-statistics/root/etc/uci-defaults/luci-statistics @@ -0,0 +1,36 @@ +#!/bin/sh + +# register commit handler +uci -q batch <<-EOF >/dev/null + delete ucitrack.@luci_statistics[-1] + add ucitrack luci_statistics + set ucitrack.@luci_statistics[-1].init=luci_statistics + commit ucitrack +EOF + +# register LuCId virtual path handler +[ -f /etc/config/lucid ] && \ +uci -q batch <<-EOF >/dev/null + delete lucid.statistics + + set lucid.statistics=DirectoryPublisher + set lucid.statistics.name='RRDTool Image Cache' + set lucid.statistics.physical=/tmp/rrdimg + set lucid.statistics.virtual=/rrdimg + set lucid.statistics.domain='' + + add_list lucid.http.publisher=statistics + add_list lucid.https.publisher=statistics + + commit lucid +EOF + +# symlink for busybox httpd +[ -x /usr/sbin/httpd ] && [ ! -h /www/rrdimg ] && \ + ln -s /tmp/rrdimg /www/rrdimg + +# restart LuCId service +[ -x /etc/init.d/lucid ] && /etc/init.d/lucid enabled && /etc/init.d/lucid restart + +rm -f /tmp/luci-indexcache +exit 0 |