diff options
author | Jean-Michel Lacroix <lacroix@lepine-lacroix.info> | 2015-11-10 15:13:52 -0500 |
---|---|---|
committer | Jean-Michel Lacroix <lacroix@lepine-lacroix.info> | 2015-11-10 15:13:52 -0500 |
commit | b885721fa0bc40496216e7f2a1f86ff26f736989 (patch) | |
tree | 1bdde97db3e6760c99cc8ec12138031ffcdacce2 /utils/bandwidthd/files | |
parent | 726e9dcafd3645928b8ca338e6ef4691cb699350 (diff) |
bandwidthd: Addition of a variant of the bandwidthd package.
Addition of the bandwidthd-pgsql package variant that can save also
in a postgres database.
Modification of bandwidthd.config to have the default IP address
of an OpenWrt router (192.168.1.1)
Addition of a small OpenWrt logo in the logo.gif
Compile tested on CC and trunk (ar71xx and mvebu in both cases)
run tested on CC (ar71xx) and trunk (r47397 on mvebu)
Signed-off-by: Jean-Michel Lacroix <lacroix@lepine-lacroix.info>
Diffstat (limited to 'utils/bandwidthd/files')
-rw-r--r-- | utils/bandwidthd/files/bandwidthd-pgsql.config | 13 | ||||
-rw-r--r-- | utils/bandwidthd/files/bandwidthd-pgsql.init | 90 | ||||
-rw-r--r-- | utils/bandwidthd/files/bandwidthd.config | 2 | ||||
-rw-r--r-- | utils/bandwidthd/files/logo.gif | bin | 7573 -> 9431 bytes |
4 files changed, 104 insertions, 1 deletions
diff --git a/utils/bandwidthd/files/bandwidthd-pgsql.config b/utils/bandwidthd/files/bandwidthd-pgsql.config new file mode 100644 index 000000000..0f8768792 --- /dev/null +++ b/utils/bandwidthd/files/bandwidthd-pgsql.config @@ -0,0 +1,13 @@ +config bandwidthd + option dev br-lan + option subnets "192.168.1.0/24" + option skip_intervals 0 + option graph_cutoff 1024 + option promiscuous true + option output_cdf false + option recover_cdf false + option filter ip + option graph true + option meta_refresh 150 + option disabled_pgsql_connect_string "user = postgres dbname = bandwidthd host = 192.168.1.1" + option disabled_sensor_id "openwrt.mydomain.domain" diff --git a/utils/bandwidthd/files/bandwidthd-pgsql.init b/utils/bandwidthd/files/bandwidthd-pgsql.init new file mode 100644 index 000000000..232fa0cb8 --- /dev/null +++ b/utils/bandwidthd/files/bandwidthd-pgsql.init @@ -0,0 +1,90 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2008-2015 OpenWrt.org + +START=99 + +config_cb() { + local cfg_type="$1" + local cfg_name="$2" + + case "$cfg_type" in + bandwidthd) + append cfgs "$cfg_name" + ;; + esac +} + +export_bool() { + local option="$1" + local section="$2" + local _loctmp + config_get_bool _loctmp "$section" "$option" + if [ -n "$_loctmp" ]; then + conffile="${conffile}$option " + if [ 1 -eq "$_loctmp" ]; then + conffile="${conffile}true" + else + conffile="${conffile}false" + fi + conffile="${conffile}\n" + fi +} + +export_number() { + local option="$1" + local section="$2" + local _loctmp + config_get _loctmp "$section" "$option" + if [ -n "$_loctmp" ]; then + conffile="${conffile}$option ${_loctmp}\n" + fi +} + +export_string() { + local option="$1" + local section="$2" + local _loctmp + config_get _loctmp "$section" "$option" + if [ -n "$_loctmp" ]; then + conffile="${conffile}$option \"${_loctmp}\"\n" + fi +} + +start() { + local subnet conffile + + [ -d /tmp/bandwidthd ] || mkdir -p /tmp/bandwidthd && cp /www/legend.gif /www/logo.gif /tmp/bandwidthd/ + [ -e /htdocs ] || ln -s /tmp/bandwidthd /htdocs + [ -e /www/bandwidthd ] || ln -s /tmp/bandwidthd /www/bandwidthd + rm -f /tmp/bandwidthd.conf + touch /tmp/bandwidthd.conf + [ -e /etc/bandwidthd.conf ] || ln -s /tmp/bandwidthd.conf /etc/bandwidthd.conf + + + config_load bandwidthd + for cfg in $cfgs; do + config_get subnets $cfg subnets + for subnet in $subnets; do + conffile="${conffile}subnet ${subnet}\n" + done + export_string dev $cfg + export_number skip_intervals $cfg + export_number graph_cutoff $cfg + export_bool promiscuous $cfg + export_bool output_cdf $cfg + export_bool recover_cdf $cfg + export_string filter $cfg + export_bool graph $cfg + export_number meta_refresh $cfg + export_string pgsql_connect_string $cfg + export_string sensor_id $cfg + [ -n "$conffile" ] && echo -e "$conffile" >>/tmp/bandwidthd.conf + unset conffile + done + cd / + service_start /usr/sbin/bandwidthd +} + +stop() { + service_stop /usr/sbin/bandwidthd +} diff --git a/utils/bandwidthd/files/bandwidthd.config b/utils/bandwidthd/files/bandwidthd.config index 4bb18cf92..0769b1c8e 100644 --- a/utils/bandwidthd/files/bandwidthd.config +++ b/utils/bandwidthd/files/bandwidthd.config @@ -1,6 +1,6 @@ config bandwidthd option dev br-lan - option subnets "192.168.0.0/16 10.0.0.0/8 172.16.0.0/12" + option subnets "192.168.1.0/24" option skip_intervals 0 option graph_cutoff 1024 option promiscuous true diff --git a/utils/bandwidthd/files/logo.gif b/utils/bandwidthd/files/logo.gif Binary files differindex 7b17cc6cb..2ffec5605 100644 --- a/utils/bandwidthd/files/logo.gif +++ b/utils/bandwidthd/files/logo.gif |