User Tools

Site Tools


doc:howto:bandwidthd
This wiki is read only and for archival purposes only. >>>>>>>>>> Please use the new OpenWrt wiki at https://openwrt.org/ <<<<<<<<<<

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
doc:howto:bandwidthd [2017/01/04 02:51]
jmlacroix [Storing bandwidthd stats in a postgresql database]
doc:howto:bandwidthd [2018/02/10 09:31] (current)
redd_llining Corrected outdated information in external storage part
Line 132: Line 132:
  
 ===== Storing bandwidthd stats in external permanent storage ===== ===== Storing bandwidthd stats in external permanent storage =====
-{{page>​meta:​infobox:​outdated&​noheader&​nofooter&​noeditbtn}} 
  
-**NOTE: This information is old and was written before the current maintainer of the bandwidthd package updated this HOWTO The information ​is probably outdated. ​ If you are able to perform this, please let the author know about it and provide the information so this HOWTO can be updated. +The default bandwidthd installation loses your previous statistics on each reboot ​and you need more space to save thoseTo keep statistics it is needed ​to modify "/​etc/​config/​bandwidthd"​.
-**+
  
-The default bandwidthd installation loses your previous statistics on each reboot. To keep statistics between reboots it is needed to modify "/​etc/​config/​bandwidthd"​ and "/​etc/​init.d/​bandwidthd"​ +You need to change "​option output_cdf true"​ and "​option recover_cdf true" and "​option sqlite_filename ​   '​file.db' ​"
- +
-The only thing to understand is that bandwidthd binary, when launched, looks for the "​httpd"​ folder and "​bandwidthd.conf"​ file in the same folder where the binary has been lauched. Default /​etc/​init.d/​bandwidthd init script creates two symlinks: +
- +
-  /httpd >> /​www/​bandwidthd +
-  /​bandwidthd.conf >> /​etc/​bandwidthd.conf  +
- +
-then move to / folder and lauches there the bandwidthd binary. +
- +
-These modifications change the init script behaviour to create httpd folder and bandwidthd.conf file in external storage. +
- +
-Suppose we have a usb stick mounted in /mnt/usb and will store the bandwidthd stats in /​mnt/​usb/​bandwidthd. Just modify the start() function in /​etc/​init.d/​bandwidthd +
- +
-<code bash> +
-start() { +
-        local subnet conffile +
- +
-        [ -d /​mnt/​usb/​bandwidthd/​htdocs ] || mkdir -p /​mnt/​usb/​bandwidthd/​htdocs && cp /​www/​legend.gif /​www/​logo.gif /​mnt/​usb/​bandwidthd/​htdocs +
-        [ -e /​www/​bandwidthd ] || ln -s /​mnt/​usb/​bandwidthd/​htdocs /​www/​bandwidthd +
-        rm -f /​mnt/​usb/​bandwidthd/​bandwidthd.conf +
-        touch /​mnt/​usb/​bandwidthd/​bandwidthd.conf +
-        [ -e /​etc/​bandwidthd.conf ] || ln -s /​mnt/​usb/​bandwidthd/​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 +
-                [ -n "​$conffile"​ ] && echo -e "​$conffile"​ >>/​mnt/​usb/​bandwidthd/​bandwidthd.conf +
-                unset conffile +
-        done +
-        cd /​mnt/​usb/​bandwidthd +
-        bandwidthd +
-+
-</​code>​ +
- +
- +
-Next modify /​etc/​config/​bandwidthd file to save statistics to disk. You need to change "​option output_cdf true"​ and "​option recover_cdf true"​+
  
 <​file>​ <​file>​
Line 199: Line 149:
  option graph true  option graph true
  option meta_refresh 150  option meta_refresh 150
 +        option SQLite_filename ​ "/​path/​to/​file.db"​ # file gets created automatically and default path works pretty well
 </​file>​ </​file>​
  
doc/howto/bandwidthd.txt · Last modified: 2018/02/10 09:31 by redd_llining