From bb4c3b5a20807e6fdf23e0c66a6d13a6e368db92 Mon Sep 17 00:00:00 2001 From: Josef Schlehofer Date: Sun, 3 Sep 2023 13:08:25 +0200 Subject: [PATCH] bandwidthd: drop this package This package is not maintained by upstream anymore as they replace it by Ntopng 3. [1] Upstream repository is archived and read only since February 2022 [2] [1] https://community.nethserver.org/t/bandwidthd-for-nethserver-7/4071/18 [2] https://github.com/NethServer/bandwidthd Signed-off-by: Josef Schlehofer --- utils/bandwidthd/Makefile | 225 --------- .../bandwidthd/files/bandwidthd-pgsql.config | 13 - utils/bandwidthd/files/bandwidthd-php.config | 7 - utils/bandwidthd/files/bandwidthd-php.init | 75 --- .../bandwidthd/files/bandwidthd-sqlite.config | 13 - utils/bandwidthd/files/bandwidthd-sqlite.init | 133 ----- utils/bandwidthd/files/bandwidthd.config | 11 - utils/bandwidthd/files/bandwidthd.init | 106 ---- utils/bandwidthd/files/logo-openwrt.gif | Bin 9431 -> 0 bytes .../files/phphtdocs-sqlite/details.php | 104 ---- .../files/phphtdocs-sqlite/footer.php | 3 - .../files/phphtdocs-sqlite/graph.php | 455 ------------------ .../files/phphtdocs-sqlite/include.php | 69 --- .../files/phphtdocs-sqlite/index.php | 190 -------- utils/bandwidthd/files/phphtdocs/details.php | 102 ---- utils/bandwidthd/files/phphtdocs/footer.php | 3 - utils/bandwidthd/files/phphtdocs/graph.php | 454 ----------------- utils/bandwidthd/files/phphtdocs/include.php | 54 --- utils/bandwidthd/files/phphtdocs/index.php | 197 -------- ...010-dont-add-host-paths-in-config.in.patch | 24 - .../patches/020-change-p2p-to-smtp.patch | 20 - utils/bandwidthd/patches/030-gcc10.patch | 20 - .../bandwidthd/patches/040-64bit-time-t.patch | 114 ----- 23 files changed, 2392 deletions(-) delete mode 100644 utils/bandwidthd/Makefile delete mode 100644 utils/bandwidthd/files/bandwidthd-pgsql.config delete mode 100644 utils/bandwidthd/files/bandwidthd-php.config delete mode 100755 utils/bandwidthd/files/bandwidthd-php.init delete mode 100644 utils/bandwidthd/files/bandwidthd-sqlite.config delete mode 100755 utils/bandwidthd/files/bandwidthd-sqlite.init delete mode 100644 utils/bandwidthd/files/bandwidthd.config delete mode 100755 utils/bandwidthd/files/bandwidthd.init delete mode 100644 utils/bandwidthd/files/logo-openwrt.gif delete mode 100644 utils/bandwidthd/files/phphtdocs-sqlite/details.php delete mode 100644 utils/bandwidthd/files/phphtdocs-sqlite/footer.php delete mode 100644 utils/bandwidthd/files/phphtdocs-sqlite/graph.php delete mode 100644 utils/bandwidthd/files/phphtdocs-sqlite/include.php delete mode 100644 utils/bandwidthd/files/phphtdocs-sqlite/index.php delete mode 100644 utils/bandwidthd/files/phphtdocs/details.php delete mode 100644 utils/bandwidthd/files/phphtdocs/footer.php delete mode 100644 utils/bandwidthd/files/phphtdocs/graph.php delete mode 100644 utils/bandwidthd/files/phphtdocs/include.php delete mode 100644 utils/bandwidthd/files/phphtdocs/index.php delete mode 100644 utils/bandwidthd/patches/010-dont-add-host-paths-in-config.in.patch delete mode 100644 utils/bandwidthd/patches/020-change-p2p-to-smtp.patch delete mode 100644 utils/bandwidthd/patches/030-gcc10.patch delete mode 100644 utils/bandwidthd/patches/040-64bit-time-t.patch diff --git a/utils/bandwidthd/Makefile b/utils/bandwidthd/Makefile deleted file mode 100644 index d0bb130007..0000000000 --- a/utils/bandwidthd/Makefile +++ /dev/null @@ -1,225 +0,0 @@ -# -# Copyright (C) 2006-2020 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:=bandwidthd -PKG_VERSION:=2.0.1-35 -PKG_RELEASE:=7 - -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://codeload.github.com/NethServer/bandwidthd/tar.gz/$(PKG_VERSION)? -PKG_HASH:=75f526d9e81c5a543accbb9e197b6b582c293aa20d6cdfc8be5cef43046981c5 - -PKG_MAINTAINER:=Jean-Michel Lacroix -PKG_LICENSE:=GPL-2.0-or-later - -PKG_FIXUP:=autoreconf -PKG_BUILD_PARALLEL:=0 - -include $(INCLUDE_DIR)/package.mk - -define Package/bandwidthd/Default - SECTION:=utils - CATEGORY:=Utilities - TITLE:=Bandwidthd - URL:=http://bandwidthd.sourceforge.net/ -endef - -define Package/bandwidthd -$(call Package/bandwidthd/Default) - TITLE += (without database) - VARIANT:=no-db - DEPENDS:=+libgd +libpcap -endef - -define Package/bandwidthd-pgsql -$(call Package/bandwidthd/Default) - TITLE += (with postgresql enabled) - VARIANT:=pgsql - DEPENDS:=+libgd +libpcap +libpq -endef - -define Package/bandwidthd-sqlite -$(call Package/bandwidthd/Default) - TITLE += (with sqlite enabled) - VARIANT:=sqlite - DEPENDS:=+libgd +libpcap +libsqlite3 +php8 +php8-cgi +php8-mod-gd +php8-mod-pdo +php8-mod-pdo-sqlite -endef - -define Package/bandwidthd-php -$(call Package/bandwidthd/Default) - TITLE = PHP files to graph bandwidthd data from postgresql - VARIANT:=php - DEPENDS:=+libpcre +libxml2 +php8 +php8-cgi +php8-mod-pgsql +php8-mod-gd -endef - -define Package/bandwidthd/description - A bandwidthd tracking utility. -endef - -define Package/bandwidthd-pgsql/description -$(call Package/bandwidthd/description) -With the ability to store in a postgresql database. -endef - -define Package/bandwidthd-sqlite/description -$(call Package/bandwidthd/description) -With the ability to store in a sqlite database. -endef - -define Package/bandwidthd-php/description - PHP files to graph bandwidthd data from pgsql. -endef - -define Package/bandwidthd/daemon - This package contains bandwidthd, a bandwidth tracking utility. -endef - -define Package/bandwidthd-pgsql/daemon - This package contains bandwidthd, a bandwidth tracking utility. -endef - -define Package/bandwidthd-sqlite/daemon - This package contains bandwidthd, a bandwidth tracking utility. -endef - -define Package/bandwidthd-php/daemon - This package contains the PHP files to graph the data from a pgsql database. -endef - -ifeq ($(BUILD_VARIANT),no-db) -CONFIGURE_ARGS += \ - ac_cv_file__sw_lib=no \ - ac_cv_file__sw_include=no \ - ac_cv_file__usr_pkg_lib=no \ - ac_cv_file__usr_pkg_include=no \ - ac_cv_file__usr_local_pgsql_lib=no \ - ac_cv_file__usr_local_pgsql_include=no \ - ac_cv_lib_pq_PQconnectdb=no \ - ac_cv_lib_sqlite3_sqlite3_open=no -endif - -ifeq ($(BUILD_VARIANT),pgsql) -CONFIGURE_ARGS += \ - ac_cv_file__sw_lib=no \ - ac_cv_file__sw_include=no \ - ac_cv_file__usr_pkg_lib=no \ - ac_cv_file__usr_pkg_include=no \ - ac_cv_file__usr_local_pgsql_lib=no \ - ac_cv_file__usr_local_pgsql_include=no \ - ac_cv_lib_sqlite3_sqlite3_open=no -endif - -ifeq ($(BUILD_VARIANT),sqlite) -CONFIGURE_ARGS += \ - ac_cv_file__sw_lib=no \ - ac_cv_file__sw_include=no \ - ac_cv_file__usr_pkg_lib=no \ - ac_cv_file__usr_pkg_include=no \ - ac_cv_file__usr_local_pgsql_lib=no \ - ac_cv_file__usr_local_pgsql_include=no \ - ac_cv_lib_pq_PQconnectdb=no -endif - -ifeq ($(BUILD_VARIANT),php) -CONFIGURE_ARGS += \ - ac_cv_file__sw_lib=no \ - ac_cv_file__sw_include=no \ - ac_cv_file__usr_pkg_lib=no \ - ac_cv_file__usr_pkg_include=no \ - ac_cv_file__usr_local_pgsql_lib=no \ - ac_cv_file__usr_local_pgsql_include=no \ - ac_cv_lib_pq_PQconnectdb=no \ - ac_cv_lib_sqlite3_sqlite3_open=no -endif - -EXTRA_CFLAGS+= $(TARGET_CPPFLAGS) -fgnu89-inline -EXTRA_LDFLAGS+= $(TARGET_LDFLAGS) - -define Package/bandwidthd/install - $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/bandwidthd $(1)/usr/sbin/ - $(INSTALL_DIR) $(1)/etc/config - $(INSTALL_DATA) ./files/bandwidthd.config $(1)/etc/config/bandwidthd - $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_BIN) ./files/bandwidthd.init $(1)/etc/init.d/bandwidthd - $(INSTALL_DIR) $(1)/www - $(INSTALL_DATA) $(PKG_BUILD_DIR)/phphtdocs/legend.gif $(1)/www/ - $(INSTALL_DATA) ./files/logo-openwrt.gif $(1)/www/logo.gif -endef - -define Package/bandwidthd-pgsql/install - $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/bandwidthd $(1)/usr/sbin/ - $(INSTALL_DIR) $(1)/etc/config - $(INSTALL_DATA) ./files/bandwidthd-pgsql.config $(1)/etc/config/bandwidthd - $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_BIN) ./files/bandwidthd.init $(1)/etc/init.d/bandwidthd - $(INSTALL_DIR) $(1)/www - $(INSTALL_DATA) $(PKG_BUILD_DIR)/phphtdocs/legend.gif $(1)/www/ - $(INSTALL_DATA) ./files/logo-openwrt.gif $(1)/www/logo.gif - $(INSTALL_DIR) $(1)/usr/share/postgresql - $(INSTALL_BIN) $(PKG_BUILD_DIR)/phphtdocs/bd_pgsql_purge.sh $(1)/usr/share/postgresql -endef - -define Package/bandwidthd-sqlite/install - $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/bandwidthd $(1)/usr/sbin/ - $(INSTALL_DIR) $(1)/etc/config - $(INSTALL_DATA) ./files/bandwidthd-sqlite.config $(1)/etc/config/bandwidthd - $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_BIN) ./files/bandwidthd-sqlite.init $(1)/etc/init.d/bandwidthd - $(INSTALL_DIR) $(1)/www/phphtdocs - $(INSTALL_DATA) $(PKG_BUILD_DIR)/phphtdocs/legend.gif $(1)/www/phphtdocs/ - $(INSTALL_DATA) ./files/phphtdocs-sqlite/details.php $(1)/www/phphtdocs/ - $(INSTALL_DATA) ./files/phphtdocs-sqlite/footer.php $(1)/www/phphtdocs/ - $(INSTALL_DATA) ./files/phphtdocs-sqlite/graph.php $(1)/www/phphtdocs/ - $(INSTALL_DATA) ./files/phphtdocs-sqlite/include.php $(1)/www/phphtdocs/ - $(INSTALL_DATA) ./files/phphtdocs-sqlite/index.php $(1)/www/phphtdocs/ - $(INSTALL_DATA) ./files/logo-openwrt.gif $(1)/www/phphtdocs/logo.gif - ln -s /var/etc/bandwidthd-php.conf $(1)/www/phphtdocs/config.conf.php - $(INSTALL_DATA) $(PKG_BUILD_DIR)/phphtdocs/legend.gif $(1)/www/ - $(INSTALL_DATA) ./files/logo-openwrt.gif $(1)/www/logo.gif -endef - -define Package/bandwidthd-php/install - $(INSTALL_DIR) $(1)/www/phphtdocs - $(INSTALL_DATA) $(PKG_BUILD_DIR)/phphtdocs/legend.gif $(1)/www/phphtdocs/ - $(INSTALL_DATA) ./files/phphtdocs/details.php $(1)/www/phphtdocs/ - $(INSTALL_DATA) ./files/phphtdocs/footer.php $(1)/www/phphtdocs/ - $(INSTALL_DATA) ./files/phphtdocs/graph.php $(1)/www/phphtdocs/ - $(INSTALL_DATA) ./files/phphtdocs/include.php $(1)/www/phphtdocs/ - $(INSTALL_DATA) ./files/phphtdocs/index.php $(1)/www/phphtdocs/ - $(INSTALL_DATA) ./files/logo-openwrt.gif $(1)/www/phphtdocs/logo.gif - ln -s /var/etc/bandwidthd-php.conf $(1)/www/phphtdocs/config.conf - $(INSTALL_DIR) $(1)//etc/config - $(INSTALL_CONF) ./files/bandwidthd-php.config $(1)/etc/config/bandwidthd-php - $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_BIN) ./files/bandwidthd-php.init $(1)/etc/init.d/bandwidthd-php -endef - -define Package/bandwidthd/conffiles -/etc/config/bandwidthd -endef - -define Package/bandwidthd-pgsql/conffiles -/etc/config/bandwidthd -endef - -define Package/bandwidthd-sqlite/conffiles -/etc/config/bandwidthd -endef - -define Package/bandwidthd-php/conffiles -/etc/config/bandwidthd-php -endef - -$(eval $(call BuildPackage,bandwidthd)) -$(eval $(call BuildPackage,bandwidthd-pgsql)) -$(eval $(call BuildPackage,bandwidthd-sqlite)) -$(eval $(call BuildPackage,bandwidthd-php)) diff --git a/utils/bandwidthd/files/bandwidthd-pgsql.config b/utils/bandwidthd/files/bandwidthd-pgsql.config deleted file mode 100644 index f94c737a56..0000000000 --- a/utils/bandwidthd/files/bandwidthd-pgsql.config +++ /dev/null @@ -1,13 +0,0 @@ -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 pgsql_connect_string "user = postgres dbname = bandwidthd host = 192.168.1.1" - option sensor_id "openwrt" diff --git a/utils/bandwidthd/files/bandwidthd-php.config b/utils/bandwidthd/files/bandwidthd-php.config deleted file mode 100644 index 3bad494460..0000000000 --- a/utils/bandwidthd/files/bandwidthd-php.config +++ /dev/null @@ -1,7 +0,0 @@ -config bandwidthd-php - option dflt_width '900' - option dflt_height '256' - option dflt_interval 'INT_DAILY' - option host '127.0.0.1' - option user 'postgres' - option dbname 'bandwidthd' diff --git a/utils/bandwidthd/files/bandwidthd-php.init b/utils/bandwidthd/files/bandwidthd-php.init deleted file mode 100755 index b7b6434f08..0000000000 --- a/utils/bandwidthd/files/bandwidthd-php.init +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/sh /etc/rc.common -# Copyright (C) 2006-2017 OpenWrt.org - -START=99 - -USE_PROCD=1 - -CONFIGNAME="bandwidthd-php" -CONFIGFILE="/var/etc/bandwidthd-php.conf" - -config_cb() { - local cfg_type="$1" - local cfg_name="$2" - case "$cfg_type" in - $CONFIGNAME) - append cfgs "$cfg_name" - ;; - esac -} - -export_number() { - local option="$1" - local section="$2" - local _loctmp - paramstr="" - config_get _loctmp "$section" "$option" - if [ -n "$_loctmp" ]; then - paramstr="${_loctmp}" - fi -} - -export_string() { - local option="$1" - local section="$2" - local _loctmp - paramstr="" - config_get _loctmp "$section" "$option" - if [ -n "$_loctmp" ]; then - paramstr="${_loctmp}" - fi -} - -service_triggers() -{ - procd_add_reload_trigger $CONFIGNAME -} - - -start_service() { - local conffile="" - [ -n "$conffile" ] && echo -e "$conffile" >>$CONFIGFILE - done -} diff --git a/utils/bandwidthd/files/bandwidthd-sqlite.config b/utils/bandwidthd/files/bandwidthd-sqlite.config deleted file mode 100644 index bc4154af22..0000000000 --- a/utils/bandwidthd/files/bandwidthd-sqlite.config +++ /dev/null @@ -1,13 +0,0 @@ -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 sqlite_filename "/www/bandwidthd/stats.db" - option sensor_id "default" diff --git a/utils/bandwidthd/files/bandwidthd-sqlite.init b/utils/bandwidthd/files/bandwidthd-sqlite.init deleted file mode 100755 index c456974ab8..0000000000 --- a/utils/bandwidthd/files/bandwidthd-sqlite.init +++ /dev/null @@ -1,133 +0,0 @@ -#!/bin/sh /etc/rc.common -# Copyright (C) 2008-2017 OpenWrt.org - -START=99 - -USE_PROCD=1 - -CONFIGNAME="bandwidthd" -CONFIGPHPNAME="bandwidthd-php" -CONFIGFILE="/tmp/etc/bandwidthd.conf" -CONFIGPHPFILE="/tmp/etc/bandwidthd-php.conf" - -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 -} - -set_conf_file() { - local subnet conffile="# auto-generated config file from /etc/config/${CONFIGNAME}\n" - - [ -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 $CONFIGFILE - touch $CONFIGFILE - [ -e /etc/bandwidthd.conf ] || ln -s $CONFIGFILE /etc/bandwidthd.conf - - config_load $CONFIGNAME - 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 sqlite_filename $cfg - export_string sensor_id $cfg - [ -n "$conffile" ] && echo -e "$conffile" >>$CONFIGFILE - unset conffile - done - cd / -} - -set_php_conf_file() { - local subnet conffile="" - [ -n "$conffile" ] && echo -e "$conffile" >>$CONFIGPHPFILE - done - cd / -} - -service_triggers() { - procd_add_reload_trigger $CONFIGNAME - procd_add_reload_trigger $CONFIGPHPNAME -} - -start_service() { - set_conf_file - set_php_conf_file - procd_open_instance - procd_set_param command /usr/sbin/bandwidthd - procd_close_instance -} - -stop_service() { - service_stop /usr/sbin/bandwidthd -} diff --git a/utils/bandwidthd/files/bandwidthd.config b/utils/bandwidthd/files/bandwidthd.config deleted file mode 100644 index ac1669ef40..0000000000 --- a/utils/bandwidthd/files/bandwidthd.config +++ /dev/null @@ -1,11 +0,0 @@ -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 diff --git a/utils/bandwidthd/files/bandwidthd.init b/utils/bandwidthd/files/bandwidthd.init deleted file mode 100755 index ac9d01dc47..0000000000 --- a/utils/bandwidthd/files/bandwidthd.init +++ /dev/null @@ -1,106 +0,0 @@ -#!/bin/sh /etc/rc.common -# Copyright (C) 2008-2017 OpenWrt.org - -START=99 - -USE_PROCD=1 - -CONFIGNAME="bandwidthd" -CONFIGFILE="/tmp/etc/bandwidthd.conf" - -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 -} - -set_conf_file() { - 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 $CONFIGFILE - touch $CONFIGFILE - [ -e /etc/bandwidthd.conf ] || ln -s $CONFIGFILE /etc/bandwidthd.conf - - config_load $CONFIGNAME - 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 sqlite_filename $cfg - export_string sensor_id $cfg - [ -n "$conffile" ] && echo -e "$conffile" >>$CONFIGFILE - unset conffile - done - cd / -} - -service_triggers() -{ - procd_add_reload_trigger $CONFIGNAME -} - -start_service() { - set_conf_file - procd_open_instance - procd_set_param command /usr/sbin/bandwidthd - procd_close_instance -} - -stop_service() { - service_stop /usr/sbin/bandwidthd -} diff --git a/utils/bandwidthd/files/logo-openwrt.gif b/utils/bandwidthd/files/logo-openwrt.gif deleted file mode 100644 index 2ffec5605b72c48f49d8ee3dc069e80baccd6aa7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9431 zcmYLO2{=^Y*S|9cV+`($oz&RMp0yB~u`iR5iXuZ2qGYGkShHtm?E5Zb4avSQ8KLY; zA!}%($b9<$zwi0p=Q;PBbIZ}eRcG-6_u=!P!g~Y{2Np%K=X@1&W`jv zt99rkxKO=l4=TTS`Dd&Oj|rtpSPl^(L+2u z>E+F>BMYBgT=rU8>>_KpsoXdmZYwM6VzuMW&JL9-=R$Q+bxJ?l*=cO;8Jb*?lcSmk zK9!@&^-q1G+hP?K7G7CdSs)OGNF>edpvaPLr^s@1Vqs0s)CdSlyS&8IT)RcRH9tRJ z*gQ5w9hzL)ETxtPZoS<7{)?3&x3cwZl}P+KG9uqh7?P6<2ncvwlP^jYjW2Bcy|6%~ z@__5S{T5H;w=jT=ZL(lfqNIWnZOvT~KWx>H$+b;)9y zI(sWLp|hu-R5Jvp!Zo&x2sLr$f#o7Kx7pdLBr1uY%D?jb`TEP3f<1bZ)X5V{Vs=pODp^ebKmT;t_=mC9UOMry|FMC^zt7bH9AF4& z{)h8lPWnlb?g{r{mktqFLa@a50215Z!%(-7U0$){5P)yVwc zm>WeC_~%RfgZ+CK05}yu!B6Ruv)cpVtYQ{@Qgf!9Mue}~O?!DY#> z0>dOfWb)w~%AkULMxymLS~84|=I%*^_6FI{eHdkF?dv33yLU+yWN9=?GfAvim-Ei> ztx{CCH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S){YxQLRI?GTW&iV}9(Ydr61ZLj~G+G7dQx^NM;-;fBccM~@ z%I$b|rd5v$MeV3ZmO>YFea=HR8+schABu{@>iF(K&=l$KIekyA{|Nb2t#f)Z9Xd8${i>QE$mFEO zsrngCvhgr6*(G=#W}#pBju)tTlpd0%_NB>G zNQg{pDwhcLn!Pz!AT2U8iFxi6F6i_qXJ2(w>qS=I)%-yP`r`#_I;AnuJ03k3=l5Qo zk@@geayOQ7ezWP0Tp}mppejojW? zs;eWfUicmIf2p+{zVt&*rR$t(q#_ecy}N^k1`FU$sh^y*5m`IF z)pX)4M20Y$XWd_Fm3IzScj`B5(6n{okzM#@O~a>WXy9rp;~H1kx(#Q$uCjGs`_W}0 z)UDsub!AKQ8dB3NsQad^)^(xoeG>MnX1Dorr>4YNJqwMtCtdzxB2}yx3dk3<6Y3Pk zy9FdPb~LoBL$hq~YL;$Y&saN3Ts!!YIlNthKxp@4puTEj)V3?s zNrxJ$(i@!K`xvhqEKdVd^k=oF;X}5>3iZdy_s47YCz$pp+V&^8_a_JSrzG@~^7~V3 z`_sDm)5rTWmise*^e5LsIo62G@ZLbhws=MTd^WWNUHy3bfjDpdxX^*v6#dxZfzSs1 zatr+ed|0_Dyb=#5Yr?DK2P%T}Yg7hbX&RJR7?e60lsz4c!59eG4m6DG*L4lL-qNp5 zA8e@|tUMYdBZsO^4OI^r6iMKl$_G0&@jdv#?q&VH$f15Ge1AE9z}BF52tR01@Kyrf zI*xyhywY&$O5@Q`7wpQrS^SX2@ZeMY2evB{kyj>#u1v`fzi&2}feDO^56|WgH_vQc zY3sVObaZ9GefXowyAPW0R?>%;oeWo>8m=U~TPq*_BxJaG#5dn%*m26RearAG(r{*B|@sYpFBhjTJ$1n=OPJswh zp!X`M@)X#03hg}#od< - -
- -Please provide a sensor_name"; - exit(1); - } - -if (isset($_GET['ip'])) - $ip = $_GET['ip']; -else - { - echo "
Please provide an ip address"; - exit(1); - } - -echo "

"; -if (strpos($ip, "/") === FALSE) - echo "$ip - ".gethostbyaddr($ip)."

"; -else - echo "Total - $ip"; - -$db = ConnectDb(); - -if ($ip == "0.0.0.0/0") - { - $rxtable = "bd_rx_total_log"; - $txtable = "bd_tx_total_log"; - } -else - { - $rxtable = "bd_rx_log"; - $txtable = "bd_tx_log"; - } - -$sql = "select rx.scale as rxscale, tx.scale as txscale, tx.total+rx.total as total, tx.total as sent, -rx.total as received, tx.tcp+rx.tcp as tcp, tx.udp+rx.udp as udp, -tx.icmp+rx.icmp as icmp, tx.http+rx.http as http, -tx.p2p+rx.p2p as p2p, tx.ftp+rx.ftp as ftp -from - -(SELECT ip, max(total/sample_duration)*8 as scale, sum(total) as total, sum(tcp) as tcp, sum(udp) as udp, sum(icmp) as icmp, -sum(http) as http, sum(p2p) as p2p, sum(ftp) as ftp -from sensors, $txtable -where sensor_name = '$sensor_name' -and sensors.sensor_id = ".$txtable.".sensor_id -$sql_subnet -group by ip) as tx, - -(SELECT ip, max(total/sample_duration)*8 as scale, sum(total) as total, sum(tcp) as tcp, sum(udp) as udp, sum(icmp) as icmp, -sum(http) as http, sum(p2p) as p2p, sum(ftp) as ftp -from sensors, $rxtable -where sensor_name = '$sensor_name' -and sensors.sensor_id = ".$rxtable.".sensor_id -$sql_subnet -group by ip) as rx - -where tx.ip = rx.ip;"; -//error_log($sql); printf('
%s
', $sql); -$db = ConnectDb(); -$result = $db->query($sql); -echo "
IpNameTotalSentReceivedtcpudpicmphttpsmtpftp"; -$r = $result->fetch(); -$db = NULL; -echo "
"; -if (strpos($ip, "/") === FALSE) - echo "$ip".gethostbyaddr($ip); -else - echo "Total$ip"; -echo fmtb($r['total']).fmtb($r['sent']).fmtb($r['received']). - fmtb($r['tcp']).fmtb($r['udp']).fmtb($r['icmp']).fmtb($r['http']). - fmtb($r['p2p']).fmtb($r['ftp']); -echo "
"; - -echo "

Daily

"; -echo "Send:

"; -echo "
"; -echo "Receive:

"; -echo "
"; - -echo "

Weekly

"; -echo "Send:

"; -echo "
"; -echo "Receive:

"; -echo "
"; - -echo "

Monthly

"; -echo "Send:

"; -echo "
"; -echo "Receive:

"; -echo "
"; - -echo "

Yearly

"; -echo "Send:

"; -echo "
"; -echo "Receive:

"; -echo "
"; diff --git a/utils/bandwidthd/files/phphtdocs-sqlite/footer.php b/utils/bandwidthd/files/phphtdocs-sqlite/footer.php deleted file mode 100644 index b3428250d4..0000000000 --- a/utils/bandwidthd/files/phphtdocs-sqlite/footer.php +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/utils/bandwidthd/files/phphtdocs-sqlite/graph.php b/utils/bandwidthd/files/phphtdocs-sqlite/graph.php deleted file mode 100644 index 82df317fba..0000000000 --- a/utils/bandwidthd/files/phphtdocs-sqlite/graph.php +++ /dev/null @@ -1,455 +0,0 @@ - $number) - { - $total[$key] /= $number; - $icmp[$key] /= $number; - $udp[$key] /= $number; - $tcp[$key] /= $number; - $ftp[$key] /= $number; - $http[$key] /= $number; - $p2p[$key] /= $number; - } - - foreach ($Count as $key => $number) - { - $a_total[$key] += $total[$key]; - $a_icmp[$key] += $icmp[$key]; - $a_udp[$key] += $udp[$key]; - $a_tcp[$key] += $tcp[$key]; - $a_ftp[$key] += $ftp[$key]; - $a_http[$key] += $http[$key]; - $a_p2p[$key] += $p2p[$key]; - - if ($a_total[$key] > $YMax) - $YMax = $a_total[$key]; - } - - unset($GLOBALS['total'], $GLOBALS['icmp'], $GLOBALS['udp'], $GLOBALS['tcp'], $GLOBALS['ftp'], $GLOBALS['http'], $GLOBALS['p2p'], $GLOBALS['Count']); - - $total = array(); - $icmp = array(); - $udp = array(); - $tcp = array(); - $ftp = array(); - $http = array(); - $p2p = array(); - $Count = array(); - } - -$db = ConnectDb(); - -// Get parameters - -if (isset($_GET['width'])) - $width = $_GET['width']; -else - $width = DFLT_WIDTH; - -if (isset($_GET['height'])) - $height = $_GET['height']; -else - $height = DFLT_HEIGHT; - -if (isset($_GET['interval'])) - $interval = $_GET['interval']; -else - $interval = DFLT_INTERVAL; - -if (isset($_GET['ip'])) - $ip = $_GET['ip']; -else - exit(1); - -if (isset($_GET['sensor_name'])) - $sensor_name = $_GET['sensor_name']; -else - exit(1); - -if (isset($_GET['timestamp'])) - $timestamp = $_GET['timestamp']; -else - $timestamp = time() - $interval + (0.05*$interval); - -if (isset($_GET['table'])) - $table = $_GET['table']; -else - $table = "bd_rx_log"; - -if (isset($_GET['yscale'])) - $yscale = $_GET['yscale']; - -$total = array(); -$icmp = array(); -$udp = array(); -$tcp = array(); -$ftp = array(); -$http = array(); -$p2p = array(); -$Count = array(); - -// Accumulator -$a_total = array(); -$a_icmp = array(); -$a_udp = array(); -$a_tcp = array(); -$a_ftp = array(); -$a_http = array(); -$a_p2p = array(); - -$sql_subnet = prepare_sql_subnet($ip); -$sql = "select *, timestamp as ts from sensors, $table where sensors.sensor_id = ".$table.".sensor_id $sql_subnet and sensor_name = '$sensor_name' and timestamp > $timestamp and timestamp < ".($timestamp+$interval)." order by ip;"; -//error_log($sql); -$result = $db->query($sql); - -// The SQL statement pulls the data out of the database ordered by IP address, that way we can average each -// datapoint for each IP address to provide smoothing and then toss the smoothed value into the accumulator -// to provide accurate total traffic rate. - -while ($row = $result->fetch()) - { - if ($row['ip'] != $last_ip) - { - AverageAndAccumulate(); - $last_ip = $row['ip']; - } - - $x = ($row['ts']-$timestamp)*(($width-XOFFSET)/$interval)+XOFFSET; - $xint = (int) $x; - - //echo "xint: ".$xint."
"; - $Count[$xint]++; - - if ($row['total']/$row['sample_duration'] > $SentPeak) - $SentPeak = $row['total']/$row['sample_duration']; - $TotalSent += $row['total']; - $total[$xint] += $row['total']/$row['sample_duration']; - $icmp[$xint] += $row['icmp']/$row['sample_duration']; - $udp[$xint] += $row['udp']/$row['sample_duration']; - $tcp[$xint] += $row['tcp']/$row['sample_duration']; - $ftp[$xint] += $row['ftp']/$row['sample_duration']; - $http[$xint] += $row['http']/$row['sample_duration']; - $p2p[$xint] += $row['p2p']/$row['sample_duration']; - } - -// One more time for the last IP -AverageAndAccumulate(); - -// Pull the data out of Accumulator -$total = $a_total; -$icmp = $a_icmp; -$udp = $a_udp; -$tcp = $a_tcp; -$ftp = $a_ftp; -$http = $a_http; -$p2p = $a_p2p; - -$YMax += $YMax*0.05; // Add an extra 5% - -// if a y scale was specified override YMax -if (isset($yscale)&& $yscale > 0) - $YMax = $yscale/8; - -// Plot the data - -header("Content-type: image/png"); - -$im = imagecreate($width, $height); -$white = imagecolorallocate($im, 255, 255, 255); -$purple = ImageColorAllocate($im, 255, 0, 255); -$green = ImageColorAllocate($im, 0, 255, 0); -$blue = ImageColorAllocate($im, 0, 0, 255); -$lblue = ImageColorAllocate($im, 128, 128, 255); -$brown = ImageColorAllocate($im, 128, 0, 0); -$red = ImageColorAllocate($im, 255, 0, 0); -$black = ImageColorAllocate($im, 0, 0, 0); - -for($Counter=XOFFSET+1; $Counter < $width; $Counter++) - { - if (isset($total[$Counter])) - { - // Convert the bytes/sec to y coords - $total[$Counter] = ($total[$Counter]*($height-YOFFSET))/$YMax; - $tcp[$Counter] = ($tcp[$Counter]*($height-YOFFSET))/$YMax; - $ftp[$Counter] = ($ftp[$Counter]*($height-YOFFSET))/$YMax; - $http[$Counter] = ($http[$Counter]*($height-YOFFSET))/$YMax; - $p2p[$Counter] = ($p2p[$Counter]*($height-YOFFSET))/$YMax; - $udp[$Counter] = ($udp[$Counter]*($height-YOFFSET))/$YMax; - $icmp[$Counter] = ($icmp[$Counter]*($height-YOFFSET))/$YMax; - - // Stack 'em up! - // Total is stacked from the bottom - // Icmp is on the bottom too - // Udp is stacked on top of icmp - $udp[$Counter] += $icmp[$Counter]; - // TCP and p2p are stacked on top of Udp - $tcp[$Counter] += $udp[$Counter]; - $p2p[$Counter] += $udp[$Counter]; - // Http is stacked on top of p2p - $http[$Counter] += $p2p[$Counter]; - // Ftp is stacked on top of http - $ftp[$Counter] += $http[$Counter]; - - // Plot them! - //echo "$Counter:".$Counter." (h-y)-t:".($height-YOFFSET) - $total[$Counter]." h-YO-1:".$height-YOFFSET-1; - ImageLine($im, $Counter, ($height-YOFFSET) - $icmp[$Counter], $Counter, $height-YOFFSET-1, $red); - ImageLine($im, $Counter, ($height-YOFFSET) - $udp[$Counter], $Counter, ($height-YOFFSET) - $icmp[$Counter] - 1, $brown); - ImageLine($im, $Counter, ($height-YOFFSET) - $tcp[$Counter], $Counter, ($height-YOFFSET) - $udp[$Counter] - 1, $green); - ImageLine($im, $Counter, ($height-YOFFSET) - $p2p[$Counter], $Counter, ($height-YOFFSET) - $udp[$Counter] - 1, $purple); - ImageLine($im, $Counter, ($height-YOFFSET) - $http[$Counter], $Counter, ($height-YOFFSET) - $p2p[$Counter] - 1, $blue); - ImageLine($im, $Counter, ($height-YOFFSET) - $ftp[$Counter], $Counter, ($height-YOFFSET) - $http[$Counter] - 1, $lblue); - } -// else -// echo $Counter." not set
"; - } - -// Margin Text -if ($SentPeak < 1024/8) - $txtPeakSendRate = sprintf("Peak Send Rate: %.1f KBits/sec", $SentPeak*8); -else if ($SentPeak < (1024*1024)/8) - $txtPeakSendRate = sprintf("Peak Send Rate: %.1f MBits/sec", ($SentPeak*8.0)/1024.0); -else - $txtPeakSendRate = sprintf("Peak Send Rate: %.1f GBits/sec", ($SentPeak*8.0)/(1024.0*1024.0)); - -if ($TotalSent < 1024) - $txtTotalSent = sprintf("Sent %.1f KBytes", $TotalSent); -else if ($TotalSent < 1024*1024) - $txtTotalSent = sprintf("Sent %.1f MBytes", $TotalSent/1024.0); -else - $txtTotalSent = sprintf("Sent %.1f GBytes", $TotalSent/(1024.0*1024.0)); - -ImageString($im, 2, XOFFSET+5, $height-20, $txtTotalSent, $black); -ImageString($im, 2, $width/2+XOFFSET/2, $height-20, $txtPeakSendRate, $black); - -// Draw X Axis - -ImageLine($im, 0, $height-YOFFSET, $width, $height-YOFFSET, $black); - -// Day/Month Seperator bars - -if ((24*60*60*($width-XOFFSET))/$interval > ($width-XOFFSET)/10) - { - $ts = getdate($timestamp); - $MarkTime = mktime(0, 0, 0, $ts['mon'], $ts['mday'], $ts['year']); - - $x = ts2x($MarkTime); - while ($x < XOFFSET) - { - $MarkTime += (24*60*60); - $x = ts2x($MarkTime); - } - - while ($x < ($width-10)) - { - // Day Lines - ImageLine($im, $x, 0, $x, $height-YOFFSET, $black); - ImageLine($im, $x+1, 0, $x+1, $height-YOFFSET, $black); - - $txtDate = strftime("%a, %b %d", $MarkTime); - ImageString($im, 2, $x-30, $height-YOFFSET+10, $txtDate, $black); - - // Calculate Next x - $MarkTime += (24*60*60); - $x = ts2x($MarkTime); - } - } -else if ((24*60*60*30*($width-XOFFSET))/$interval > ($width-XOFFSET)/10) - { - // Monthly Bars - $ts = getdate($timestamp); - $month = $ts['mon']; - $MarkTime = mktime(0, 0, 0, $month, 1, $ts['year']); - - $x = ts2x($MarkTime); - while ($x < XOFFSET) - { - $month++; - $MarkTime = mktime(0, 0, 0, $month, 1, $ts['year']); - $x = ts2x($MarkTime); - } - - while ($x < ($width-10)) - { - // Day Lines - ImageLine($im, $x, 0, $x, $height-YOFFSET, $black); - ImageLine($im, $x+1, 0, $x+1, $height-YOFFSET, $black); - - $txtDate = strftime("%b, %Y", $MarkTime); - ImageString($im, 2, $x-25, $height-YOFFSET+10, $txtDate, $black); - - // Calculate Next x - $month++; - $MarkTime = mktime(0, 0, 0, $month, 1, $ts['year']); - $x = ts2x($MarkTime); - } - } -else - { - // Year Bars - $ts = getdate($timestamp); - $year = $ts['year']; - $MarkTime = mktime(0, 0, 0, 1, 1, $year); - - $x = ts2x($MarkTime); - while ($x < XOFFSET) - { - $year++; - $MarkTime = mktime(0, 0, 0, 1, 1, $year); - $x = ts2x($MarkTime); - } - - while ($x < ($width-10)) - { - // Day Lines - ImageLine($im, $x, 0, $x, $height-YOFFSET, $black); - ImageLine($im, $x+1, 0, $x+1, $height-YOFFSET, $black); - - $txtDate = strftime("%b, %Y", $MarkTime); - ImageString($im, 2, $x-25, $height-YOFFSET+10, $txtDate, $black); - - // Calculate Next x - $year++; - $MarkTime = mktime(0, 0, 0, 1, 1, $year); - $x = ts2x($MarkTime); - } - } - -// Draw Major Tick Marks -if ((6*60*60*($width-XOFFSET))/$interval > 10) // pixels per 6 hours is more than 2 - $MarkTimeStep = 6*60*60; // Major ticks are 6 hours -else if ((24*60*60*($width-XOFFSET))/$interval > 10) - $MarkTimeStep = 24*60*60; // Major ticks are 24 hours; -else if ((24*60*60*30*($width-XOFFSET))/$interval > 10) - { - // Major tick marks are months - $MarkTimeStep = 0; // Skip the standard way of drawing major tick marks below - - $ts = getdate($timestamp); - $month = $ts['mon']; - $MarkTime = mktime(0, 0, 0, $month, 1, $ts['year']); - - $x = ts2x($MarkTime); - while ($x < XOFFSET) - { - $month++; - $MarkTime = mktime(0, 0, 0, $month, 1, $ts['year']); - $x = ts2x($MarkTime); - } - - while ($x < ($width-10)) - { - // Day Lines - $date = getdate($MarkTime); - if ($date['mon'] != 1) - { - ImageLine($im, $x, $height-YOFFSET-5, $x, $height-YOFFSET+5, $black); - $txtDate = strftime("%b", $MarkTime); - ImageString($im, 2, $x-5, $height-YOFFSET+10, $txtDate, $black); - } - - // Calculate Next x - $month++; - $MarkTime = mktime(0, 0, 0, $month, 1, $ts['year']); - $x = ts2x($MarkTime); - } - } -else - $MarkTimeStep = 0; // Skip Major Tick Marks - -if ($MarkTimeStep) - { - $ts = getdate($timestamp); - $MarkTime = mktime(0, 0, 0, $ts['mon'], $ts['mday'], $ts['year']); - $x = ts2x($MarkTime); - - while ($x < ($width-10)) - { - if ($x > XOFFSET) - { - ImageLine($im, $x, $height-YOFFSET-5, $x, $height-YOFFSET+5, $black); - } - $MarkTime += $MarkTimeStep; - $x = ts2x($MarkTime); - } - } - -// Draw Minor Tick marks -if ((60*60*($width-XOFFSET))/$interval > 4) // pixels per hour is more than 2 - $MarkTimeStep = 60*60; // Minor ticks are 1 hour -else if ((6*60*60*($width-XOFFSET))/$interval > 4) - $MarkTimeStep = 6*60*60; // Minor ticks are 6 hours -else if ((24*60*60*($width-XOFFSET))/$interval > 4) - $MarkTimeStep = 24*60*60; -else - $MarkTimeStep = 0; // Skip minor tick marks - -if ($MarkTimeStep) - { - $ts = getdate($timestamp); - $MarkTime = mktime(0, 0, 0, $ts['mon'], $ts['mday'], $ts['year']); - $x = ts2x($MarkTime); - - while ($x < ($width-10)) - { - if ($x > XOFFSET) - { - ImageLine($im, $x, $height-YOFFSET, $x, $height-YOFFSET+5, $black); - } - $MarkTime += $MarkTimeStep; - $x = ts2x($MarkTime); - } - } - -// Draw Y Axis -ImageLine($im, XOFFSET, 0, XOFFSET, $height, $black); - -$YLegend = 'k'; -$Divisor = 1; -if ($YMax*8 > 1024*2) - { - $Divisor = 1024; // Display in m - $YLegend = 'm'; - } - -if ($YMax*8 > 1024*1024*2) - { - $Divisor = 1024*1024; // Display in g - $YLegend = 'g'; - } - -if ($YMax*8 > 1024*1024*1024*2) - { - $Divisor = 1024*1024*1024; // Display in t - $YLegend = 't'; - } - -$YStep = $YMax/10; -if ($YStep < 1) - $YStep=1; -$YTic=$YStep; - -while ($YTic <= ($YMax - $YMax/10)) - { - $y = ($height-YOFFSET)-(($YTic*($height-YOFFSET))/$YMax); - ImageLine($im, XOFFSET, $y, $width, $y, $black); - $txtYLegend = sprintf("%4.1f %sbits/s", (8.0*$YTic)/$Divisor, $YLegend); - ImageString($im, 2, 3, $y-7, $txtYLegend, $black); - $YTic += $YStep; - } - -imagepng($im); -imagedestroy($im); diff --git a/utils/bandwidthd/files/phphtdocs-sqlite/include.php b/utils/bandwidthd/files/phphtdocs-sqlite/include.php deleted file mode 100644 index 51950980db..0000000000 --- a/utils/bandwidthd/files/phphtdocs-sqlite/include.php +++ /dev/null @@ -1,69 +0,0 @@ -getMessage()); - } - return $db; -} - -function fmtb($kbytes) - { - $Max = 1024; - $Output = $kbytes; - $Suffix = 'K'; - - if ($Output > $Max) - { - $Output /= 1024; - $Suffix = 'M'; - } - - if ($Output > $Max) - { - $Output /= 1024; - $Suffix = 'G'; - } - - if ($Output > $Max) - { - $Output /= 1024; - $Suffix = 'T'; - } - - return(sprintf("%.1f%s", $Output, $Suffix)); - } - -function ip2s32($ip) { - $i = ip2long($ip); - return ($i & 0x80000000 ? '-' . ((~$i & 0x7fffffff)+1) : ''. ($i & 0x7fffffff)); -} - -function prepare_sql_subnet($subnet) { - list($snet, $smask) = explode('/', $subnet); - $inet = ip2s32($snet); - if($smask > 0 && $smask < 32) { - $mask = -1 << (32 - (int)$smask); - return "and (ip & $mask = $inet)"; - } elseif ($inet) { - return "and ip = " . $inet; - } - return ""; -} - -$starttime = time(); -set_time_limit(300); -?> diff --git a/utils/bandwidthd/files/phphtdocs-sqlite/index.php b/utils/bandwidthd/files/phphtdocs-sqlite/index.php deleted file mode 100644 index c8b8598d15..0000000000 --- a/utils/bandwidthd/files/phphtdocs-sqlite/index.php +++ /dev/null @@ -1,190 +0,0 @@ - - -
- - -
- - -
- - - -Subnet Filter:"> - -
-
-Top $limit - $sensor_name"; -else - echo "

All Records - $sensor_name

"; - -// Sqlize the incomming variables -if (isset($subnet)) { - $sql_subnet = prepare_sql_subnet($subnet); -} - -// Sql Statement -$sql = "select tx.ip, rx.scale as rxscale, tx.scale as txscale, tx.total+rx.total as total, tx.total as sent, -rx.total as received, tx.tcp+rx.tcp as tcp, tx.udp+rx.udp as udp, -tx.icmp+rx.icmp as icmp, tx.http+rx.http as http, -tx.p2p+rx.p2p as p2p, tx.ftp+rx.ftp as ftp -from - -(SELECT ip, max(total/sample_duration)*8 as scale, sum(total) as total, sum(tcp) as tcp, sum(udp) as udp, sum(icmp) as icmp, -sum(http) as http, sum(p2p) as p2p, sum(ftp) as ftp -from sensors, bd_tx_log -where sensor_name = '$sensor_name' -and sensors.sensor_id = bd_tx_log.sensor_id -$sql_subnet -and timestamp > $timestamp and timestamp < ".($timestamp+$interval)." -group by ip) as tx, - -(SELECT ip, max(total/sample_duration)*8 as scale, sum(total) as total, sum(tcp) as tcp, sum(udp) as udp, sum(icmp) as icmp, -sum(http) as http, sum(p2p) as p2p, sum(ftp) as ftp -from sensors, bd_rx_log -where sensor_name = '$sensor_name' -and sensors.sensor_id = bd_rx_log.sensor_id -$sql_subnet -and timestamp > $timestamp and timestamp < ".($timestamp+$interval)." -group by ip) as rx - -where tx.ip = rx.ip -order by total desc;"; - -//echo "
$sql
"; error_log($sql); -$pdoResult = $db->query($sql); -$result = $pdoResult->fetchAll(); -$db = NULL; -$num_rows = count($result); -if ($limit == "all") - $limit = $num_rows; - -echo "
IpNameTotalSentReceivedtcpudpicmphttpsmtpftp"; - -if (!isset($subnet)) // Set this now for total graphs - $subnet = "0.0.0.0/0"; - -// Output Total Line -echo "
Total$subnet"; -foreach (array("total", "sent", "received", "tcp", "udp", "icmp", "http", "p2p", "ftp") as $key) - { - for($Counter=0, $Total = 0; $Counter < $num_rows; $Counter++) - { - $r = $result[$Counter]; - $Total += $r[$key]; - } - echo fmtb($Total); - } -echo "\n"; - -// Output Other Lines -for($Counter=0; $Counter < $num_rows && $Counter < $limit; $Counter++) - { - $r = $result[$Counter]; - $r['ip'] = long2ip($r['ip']); - echo "
"; - echo $r['ip']."".gethostbyaddr($r['ip']); - echo ""; - echo fmtb($r['total']).fmtb($r['sent']).fmtb($r['received']). - fmtb($r['tcp']).fmtb($r['udp']).fmtb($r['icmp']).fmtb($r['http']). - fmtb($r['p2p']).fmtb($r['ftp'])."\n"; - } -echo "
"; - -// Output Total Graph -for($Counter=0, $Total = 0; $Counter < $num_rows; $Counter++) - { - $r = $result[$Counter]; - $scale = max($r['txscale'], $scale); - $scale = max($r['rxscale'], $scale); - } - -if ($subnet == "0.0.0.0/0") - $total_table = "bd_tx_total_log"; -else - $total_table = "bd_tx_log"; -echo "

"; -echo "Total - Total of $subnet

"; -echo ""; -echo "Send:

"; -echo "
\n"; -if ($subnet == "0.0.0.0/0") - $total_table = "bd_rx_total_log"; -else - $total_table = "bd_rx_log"; -echo "Receive:

"; -echo "
\n"; - - -// Output Other Graphs -for($Counter=0; $Counter < $num_rows && $Counter < $limit; $Counter++) - { - $r = $result[$Counter]; - $r['ip'] = long2ip($r['ip']); - echo "

"; - if ($r['ip'] == "0.0.0.0") - echo "Total - Total of all subnets

"; - else - echo $r['ip']." - ".gethostbyaddr($r['ip']).""; - echo ""; - echo "Send:

"; - echo "
\n"; - echo "Receive:

"; - echo "
\n"; - } - -include('footer.php'); diff --git a/utils/bandwidthd/files/phphtdocs/details.php b/utils/bandwidthd/files/phphtdocs/details.php deleted file mode 100644 index cb52f43278..0000000000 --- a/utils/bandwidthd/files/phphtdocs/details.php +++ /dev/null @@ -1,102 +0,0 @@ - - -
- -Please provide a sensor_name"; - exit(1); - } - -if (isset($_GET['ip'])) - $ip = $_GET['ip']; -else - { - echo "
Please provide an ip address"; - exit(1); - } - -echo "

"; -if (strpos($ip, "/") === FALSE) - echo "$ip - ".gethostbyaddr($ip)."

"; -else - echo "Total - $ip"; - -$db = ConnectDb(); - -if ($ip == "0.0.0.0/0") - { - $rxtable = "bd_rx_total_log"; - $txtable = "bd_tx_total_log"; - } -else - { - $rxtable = "bd_rx_log"; - $txtable = "bd_tx_log"; - } - -$sql = "select rx.scale as rxscale, tx.scale as txscale, tx.total+rx.total as total, tx.total as sent, -rx.total as received, tx.tcp+rx.tcp as tcp, tx.udp+rx.udp as udp, -tx.icmp+rx.icmp as icmp, tx.http+rx.http as http, -tx.p2p+rx.p2p as p2p, tx.ftp+rx.ftp as ftp -from - -(SELECT ip, max(total/sample_duration)*8 as scale, sum(total) as total, sum(tcp) as tcp, sum(udp) as udp, sum(icmp) as icmp, -sum(http) as http, sum(p2p) as p2p, sum(ftp) as ftp -from sensors, $txtable -where sensor_name = '$sensor_name' -and sensors.sensor_id = ".$txtable.".sensor_id -and ip <<= '$ip' -group by ip) as tx, - -(SELECT ip, max(total/sample_duration)*8 as scale, sum(total) as total, sum(tcp) as tcp, sum(udp) as udp, sum(icmp) as icmp, -sum(http) as http, sum(p2p) as p2p, sum(ftp) as ftp -from sensors, $rxtable -where sensor_name = '$sensor_name' -and sensors.sensor_id = ".$rxtable.".sensor_id -and ip <<= '$ip' -group by ip) as rx - -where tx.ip = rx.ip;"; -//echo "
$sql
";exit(0); -$result = pg_query($sql); -echo "
IpNameTotalSentReceivedtcpudpicmphttpsmtpftp"; -$r = pg_fetch_array($result); -echo "
"; -if (strpos($ip, "/") === FALSE) - echo "$ip".gethostbyaddr($ip); -else - echo "Total$ip"; -echo fmtb($r['total']).fmtb($r['sent']).fmtb($r['received']). - fmtb($r['tcp']).fmtb($r['udp']).fmtb($r['icmp']).fmtb($r['http']). - fmtb($r['p2p']).fmtb($r['ftp']); -echo "
"; - -echo "

Daily

"; -echo "Send:

"; -echo "
"; -echo "Receive:

"; -echo "
"; - -echo "

Weekly

"; -echo "Send:

"; -echo "
"; -echo "Receive:

"; -echo "
"; - -echo "

Monthly

"; -echo "Send:

"; -echo "
"; -echo "Receive:

"; -echo "
"; - -echo "

Yearly

"; -echo "Send:

"; -echo "
"; -echo "Receive:

"; -echo "
"; diff --git a/utils/bandwidthd/files/phphtdocs/footer.php b/utils/bandwidthd/files/phphtdocs/footer.php deleted file mode 100644 index b3428250d4..0000000000 --- a/utils/bandwidthd/files/phphtdocs/footer.php +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/utils/bandwidthd/files/phphtdocs/graph.php b/utils/bandwidthd/files/phphtdocs/graph.php deleted file mode 100644 index 323d659edc..0000000000 --- a/utils/bandwidthd/files/phphtdocs/graph.php +++ /dev/null @@ -1,454 +0,0 @@ - $number) - { - $total[$key] /= $number; - $icmp[$key] /= $number; - $udp[$key] /= $number; - $tcp[$key] /= $number; - $ftp[$key] /= $number; - $http[$key] /= $number; - $p2p[$key] /= $number; - } - - foreach ($Count as $key => $number) - { - $a_total[$key] += $total[$key]; - $a_icmp[$key] += $icmp[$key]; - $a_udp[$key] += $udp[$key]; - $a_tcp[$key] += $tcp[$key]; - $a_ftp[$key] += $ftp[$key]; - $a_http[$key] += $http[$key]; - $a_p2p[$key] += $p2p[$key]; - - if ($a_total[$key] > $YMax) - $YMax = $a_total[$key]; - } - - unset($GLOBALS['total'], $GLOBALS['icmp'], $GLOBALS['udp'], $GLOBALS['tcp'], $GLOBALS['ftp'], $GLOBALS['http'], $GLOBALS['p2p'], $GLOBALS['Count']); - - $total = array(); - $icmp = array(); - $udp = array(); - $tcp = array(); - $ftp = array(); - $http = array(); - $p2p = array(); - $Count = array(); - } - -$db = ConnectDb(); - -// Get parameters - -if (isset($_GET['width'])) - $width = $_GET['width']; -else - $width = DFLT_WIDTH; - -if (isset($_GET['height'])) - $height = $_GET['height']; -else - $height = DFLT_HEIGHT; - -if (isset($_GET['interval'])) - $interval = $_GET['interval']; -else - $interval = DFLT_INTERVAL; - -if (isset($_GET['ip'])) - $ip = $_GET['ip']; -else - exit(1); - -if (isset($_GET['sensor_name'])) - $sensor_name = $_GET['sensor_name']; -else - exit(1); - -if (isset($_GET['timestamp'])) - $timestamp = $_GET['timestamp']; -else - $timestamp = time() - $interval + (0.05*$interval); - -if (isset($_GET['table'])) - $table = $_GET['table']; -else - $table = "bd_rx_log"; - -if (isset($_GET['yscale'])) - $yscale = $_GET['yscale']; - -$total = array(); -$icmp = array(); -$udp = array(); -$tcp = array(); -$ftp = array(); -$http = array(); -$p2p = array(); -$Count = array(); - -// Accumulator -$a_total = array(); -$a_icmp = array(); -$a_udp = array(); -$a_tcp = array(); -$a_ftp = array(); -$a_http = array(); -$a_p2p = array(); - -$sql = "select *, extract(epoch from timestamp) as ts from sensors, $table where sensors.sensor_id = ".$table.".sensor_id and ip <<= '$ip' and sensor_name = '$sensor_name' and timestamp > $timestamp::abstime and timestamp < ".($timestamp+$interval)."::abstime order by ip;"; -//echo $sql."
"; exit(1); -$result = pg_query($sql); - -// The SQL statement pulls the data out of the database ordered by IP address, that way we can average each -// datapoint for each IP address to provide smoothing and then toss the smoothed value into the accumulator -// to provide accurate total traffic rate. - -while ($row = pg_fetch_array($result)) - { - if ($row['ip'] != $last_ip) - { - AverageAndAccumulate(); - $last_ip = $row['ip']; - } - - $x = ($row['ts']-$timestamp)*(($width-XOFFSET)/$interval)+XOFFSET; - $xint = (int) $x; - - //echo "xint: ".$xint."
"; - $Count[$xint]++; - - if ($row['total']/$row['sample_duration'] > $SentPeak) - $SentPeak = $row['total']/$row['sample_duration']; - $TotalSent += $row['total']; - $total[$xint] += $row['total']/$row['sample_duration']; - $icmp[$xint] += $row['icmp']/$row['sample_duration']; - $udp[$xint] += $row['udp']/$row['sample_duration']; - $tcp[$xint] += $row['tcp']/$row['sample_duration']; - $ftp[$xint] += $row['ftp']/$row['sample_duration']; - $http[$xint] += $row['http']/$row['sample_duration']; - $p2p[$xint] += $row['p2p']/$row['sample_duration']; - } - -// One more time for the last IP -AverageAndAccumulate(); - -// Pull the data out of Accumulator -$total = $a_total; -$icmp = $a_icmp; -$udp = $a_udp; -$tcp = $a_tcp; -$ftp = $a_ftp; -$http = $a_http; -$p2p = $a_p2p; - -$YMax += $YMax*0.05; // Add an extra 5% - -// if a y scale was specified override YMax -if (isset($yscale)) - $YMax = $yscale/8; - -// Plot the data - -header("Content-type: image/png"); - -$im = imagecreate($width, $height); -$white = imagecolorallocate($im, 255, 255, 255); -$purple = ImageColorAllocate($im, 255, 0, 255); -$green = ImageColorAllocate($im, 0, 255, 0); -$blue = ImageColorAllocate($im, 0, 0, 255); -$lblue = ImageColorAllocate($im, 128, 128, 255); -$brown = ImageColorAllocate($im, 128, 0, 0); -$red = ImageColorAllocate($im, 255, 0, 0); -$black = ImageColorAllocate($im, 0, 0, 0); - -for($Counter=XOFFSET+1; $Counter < $width; $Counter++) - { - if (isset($total[$Counter])) - { - // Convert the bytes/sec to y coords - $total[$Counter] = ($total[$Counter]*($height-YOFFSET))/$YMax; - $tcp[$Counter] = ($tcp[$Counter]*($height-YOFFSET))/$YMax; - $ftp[$Counter] = ($ftp[$Counter]*($height-YOFFSET))/$YMax; - $http[$Counter] = ($http[$Counter]*($height-YOFFSET))/$YMax; - $p2p[$Counter] = ($p2p[$Counter]*($height-YOFFSET))/$YMax; - $udp[$Counter] = ($udp[$Counter]*($height-YOFFSET))/$YMax; - $icmp[$Counter] = ($icmp[$Counter]*($height-YOFFSET))/$YMax; - - // Stack 'em up! - // Total is stacked from the bottom - // Icmp is on the bottom too - // Udp is stacked on top of icmp - $udp[$Counter] += $icmp[$Counter]; - // TCP and p2p are stacked on top of Udp - $tcp[$Counter] += $udp[$Counter]; - $p2p[$Counter] += $udp[$Counter]; - // Http is stacked on top of p2p - $http[$Counter] += $p2p[$Counter]; - // Ftp is stacked on top of http - $ftp[$Counter] += $http[$Counter]; - - // Plot them! - //echo "$Counter:".$Counter." (h-y)-t:".($height-YOFFSET) - $total[$Counter]." h-YO-1:".$height-YOFFSET-1; - ImageLine($im, $Counter, ($height-YOFFSET) - $icmp[$Counter], $Counter, $height-YOFFSET-1, $red); - ImageLine($im, $Counter, ($height-YOFFSET) - $udp[$Counter], $Counter, ($height-YOFFSET) - $icmp[$Counter] - 1, $brown); - ImageLine($im, $Counter, ($height-YOFFSET) - $tcp[$Counter], $Counter, ($height-YOFFSET) - $udp[$Counter] - 1, $green); - ImageLine($im, $Counter, ($height-YOFFSET) - $p2p[$Counter], $Counter, ($height-YOFFSET) - $udp[$Counter] - 1, $purple); - ImageLine($im, $Counter, ($height-YOFFSET) - $http[$Counter], $Counter, ($height-YOFFSET) - $p2p[$Counter] - 1, $blue); - ImageLine($im, $Counter, ($height-YOFFSET) - $ftp[$Counter], $Counter, ($height-YOFFSET) - $http[$Counter] - 1, $lblue); - } -// else -// echo $Counter." not set
"; - } - -// Margin Text -if ($SentPeak < 1024/8) - $txtPeakSendRate = sprintf("Peak Send Rate: %.1f KBits/sec", $SentPeak*8); -else if ($SentPeak < (1024*1024)/8) - $txtPeakSendRate = sprintf("Peak Send Rate: %.1f MBits/sec", ($SentPeak*8.0)/1024.0); -else - $txtPeakSendRate = sprintf("Peak Send Rate: %.1f GBits/sec", ($SentPeak*8.0)/(1024.0*1024.0)); - -if ($TotalSent < 1024) - $txtTotalSent = sprintf("Sent %.1f KBytes", $TotalSent); -else if ($TotalSent < 1024*1024) - $txtTotalSent = sprintf("Sent %.1f MBytes", $TotalSent/1024.0); -else - $txtTotalSent = sprintf("Sent %.1f GBytes", $TotalSent/(1024.0*1024.0)); - -ImageString($im, 2, XOFFSET+5, $height-20, $txtTotalSent, $black); -ImageString($im, 2, $width/2+XOFFSET/2, $height-20, $txtPeakSendRate, $black); - -// Draw X Axis - -ImageLine($im, 0, $height-YOFFSET, $width, $height-YOFFSET, $black); - -// Day/Month Seperator bars - -if ((24*60*60*($width-XOFFSET))/$interval > ($width-XOFFSET)/10) - { - $ts = getdate($timestamp); - $MarkTime = mktime(0, 0, 0, $ts['mon'], $ts['mday'], $ts['year']); - - $x = ts2x($MarkTime); - while ($x < XOFFSET) - { - $MarkTime += (24*60*60); - $x = ts2x($MarkTime); - } - - while ($x < ($width-10)) - { - // Day Lines - ImageLine($im, $x, 0, $x, $height-YOFFSET, $black); - ImageLine($im, $x+1, 0, $x+1, $height-YOFFSET, $black); - - $txtDate = strftime("%a, %b %d", $MarkTime); - ImageString($im, 2, $x-30, $height-YOFFSET+10, $txtDate, $black); - - // Calculate Next x - $MarkTime += (24*60*60); - $x = ts2x($MarkTime); - } - } -else if ((24*60*60*30*($width-XOFFSET))/$interval > ($width-XOFFSET)/10) - { - // Monthly Bars - $ts = getdate($timestamp); - $month = $ts['mon']; - $MarkTime = mktime(0, 0, 0, $month, 1, $ts['year']); - - $x = ts2x($MarkTime); - while ($x < XOFFSET) - { - $month++; - $MarkTime = mktime(0, 0, 0, $month, 1, $ts['year']); - $x = ts2x($MarkTime); - } - - while ($x < ($width-10)) - { - // Day Lines - ImageLine($im, $x, 0, $x, $height-YOFFSET, $black); - ImageLine($im, $x+1, 0, $x+1, $height-YOFFSET, $black); - - $txtDate = strftime("%b, %Y", $MarkTime); - ImageString($im, 2, $x-25, $height-YOFFSET+10, $txtDate, $black); - - // Calculate Next x - $month++; - $MarkTime = mktime(0, 0, 0, $month, 1, $ts['year']); - $x = ts2x($MarkTime); - } - } -else - { - // Year Bars - $ts = getdate($timestamp); - $year = $ts['year']; - $MarkTime = mktime(0, 0, 0, 1, 1, $year); - - $x = ts2x($MarkTime); - while ($x < XOFFSET) - { - $year++; - $MarkTime = mktime(0, 0, 0, 1, 1, $year); - $x = ts2x($MarkTime); - } - - while ($x < ($width-10)) - { - // Day Lines - ImageLine($im, $x, 0, $x, $height-YOFFSET, $black); - ImageLine($im, $x+1, 0, $x+1, $height-YOFFSET, $black); - - $txtDate = strftime("%b, %Y", $MarkTime); - ImageString($im, 2, $x-25, $height-YOFFSET+10, $txtDate, $black); - - // Calculate Next x - $year++; - $MarkTime = mktime(0, 0, 0, 1, 1, $year); - $x = ts2x($MarkTime); - } - } - -// Draw Major Tick Marks -if ((6*60*60*($width-XOFFSET))/$interval > 10) // pixels per 6 hours is more than 2 - $MarkTimeStep = 6*60*60; // Major ticks are 6 hours -else if ((24*60*60*($width-XOFFSET))/$interval > 10) - $MarkTimeStep = 24*60*60; // Major ticks are 24 hours; -else if ((24*60*60*30*($width-XOFFSET))/$interval > 10) - { - // Major tick marks are months - $MarkTimeStep = 0; // Skip the standard way of drawing major tick marks below - - $ts = getdate($timestamp); - $month = $ts['mon']; - $MarkTime = mktime(0, 0, 0, $month, 1, $ts['year']); - - $x = ts2x($MarkTime); - while ($x < XOFFSET) - { - $month++; - $MarkTime = mktime(0, 0, 0, $month, 1, $ts['year']); - $x = ts2x($MarkTime); - } - - while ($x < ($width-10)) - { - // Day Lines - $date = getdate($MarkTime); - if ($date['mon'] != 1) - { - ImageLine($im, $x, $height-YOFFSET-5, $x, $height-YOFFSET+5, $black); - $txtDate = strftime("%b", $MarkTime); - ImageString($im, 2, $x-5, $height-YOFFSET+10, $txtDate, $black); - } - - // Calculate Next x - $month++; - $MarkTime = mktime(0, 0, 0, $month, 1, $ts['year']); - $x = ts2x($MarkTime); - } - } -else - $MarkTimeStep = 0; // Skip Major Tick Marks - -if ($MarkTimeStep) - { - $ts = getdate($timestamp); - $MarkTime = mktime(0, 0, 0, $ts['mon'], $ts['mday'], $ts['year']); - $x = ts2x($MarkTime); - - while ($x < ($width-10)) - { - if ($x > XOFFSET) - { - ImageLine($im, $x, $height-YOFFSET-5, $x, $height-YOFFSET+5, $black); - } - $MarkTime += $MarkTimeStep; - $x = ts2x($MarkTime); - } - } - -// Draw Minor Tick marks -if ((60*60*($width-XOFFSET))/$interval > 4) // pixels per hour is more than 2 - $MarkTimeStep = 60*60; // Minor ticks are 1 hour -else if ((6*60*60*($width-XOFFSET))/$interval > 4) - $MarkTimeStep = 6*60*60; // Minor ticks are 6 hours -else if ((24*60*60*($width-XOFFSET))/$interval > 4) - $MarkTimeStep = 24*60*60; -else - $MarkTimeStep = 0; // Skip minor tick marks - -if ($MarkTimeStep) - { - $ts = getdate($timestamp); - $MarkTime = mktime(0, 0, 0, $ts['mon'], $ts['mday'], $ts['year']); - $x = ts2x($MarkTime); - - while ($x < ($width-10)) - { - if ($x > XOFFSET) - { - ImageLine($im, $x, $height-YOFFSET, $x, $height-YOFFSET+5, $black); - } - $MarkTime += $MarkTimeStep; - $x = ts2x($MarkTime); - } - } - -// Draw Y Axis -ImageLine($im, XOFFSET, 0, XOFFSET, $height, $black); - -$YLegend = 'k'; -$Divisor = 1; -if ($YMax*8 > 1024*2) - { - $Divisor = 1024; // Display in m - $YLegend = 'm'; - } - -if ($YMax*8 > 1024*1024*2) - { - $Divisor = 1024*1024; // Display in g - $YLegend = 'g'; - } - -if ($YMax*8 > 1024*1024*1024*2) - { - $Divisor = 1024*1024*1024; // Display in t - $YLegend = 't'; - } - -$YStep = $YMax/10; -if ($YStep < 1) - $YStep=1; -$YTic=$YStep; - -while ($YTic <= ($YMax - $YMax/10)) - { - $y = ($height-YOFFSET)-(($YTic*($height-YOFFSET))/$YMax); - ImageLine($im, XOFFSET, $y, $width, $y, $black); - $txtYLegend = sprintf("%4.1f %sbits/s", (8.0*$YTic)/$Divisor, $YLegend); - ImageString($im, 2, 3, $y-7, $txtYLegend, $black); - $YTic += $YStep; - } - -imagepng($im); -imagedestroy($im); diff --git a/utils/bandwidthd/files/phphtdocs/include.php b/utils/bandwidthd/files/phphtdocs/include.php deleted file mode 100644 index 6b435d1b96..0000000000 --- a/utils/bandwidthd/files/phphtdocs/include.php +++ /dev/null @@ -1,54 +0,0 @@ - $Max) - { - $Output /= 1024; - $Suffix = 'M'; - } - - if ($Output > $Max) - { - $Output /= 1024; - $Suffix = 'G'; - } - - if ($Output > $Max) - { - $Output /= 1024; - $Suffix = 'T'; - } - - return(sprintf("%.1f%s", $Output, $Suffix)); - } - -$starttime = time(); -set_time_limit(300); -?> diff --git a/utils/bandwidthd/files/phphtdocs/index.php b/utils/bandwidthd/files/phphtdocs/index.php deleted file mode 100644 index b3602afdeb..0000000000 --- a/utils/bandwidthd/files/phphtdocs/index.php +++ /dev/null @@ -1,197 +0,0 @@ - - -
- - -
> - - -
- - - - -Subnet Filter:"> - -
-
-Top $limit - $sensor_name"; -else - echo "

All Records - $sensor_name

"; - -// Sqlize the incomming variables -if (isset($subnet)) - $sql_subnet = "and ip <<= '$subnet'"; - -// Sql Statement -$sql = "select tx.ip, rx.scale as rxscale, tx.scale as txscale, tx.total+rx.total as total, tx.total as sent, -rx.total as received, tx.tcp+rx.tcp as tcp, tx.udp+rx.udp as udp, -tx.icmp+rx.icmp as icmp, tx.http+rx.http as http, -tx.p2p+rx.p2p as p2p, tx.ftp+rx.ftp as ftp -from - -(SELECT ip, max(total/sample_duration)*8 as scale, sum(total) as total, sum(tcp) as tcp, sum(udp) as udp, sum(icmp) as icmp, -sum(http) as http, sum(p2p) as p2p, sum(ftp) as ftp -from sensors, bd_tx_log -where sensor_name = '$sensor_name' -and sensors.sensor_id = bd_tx_log.sensor_id -$sql_subnet -and timestamp > $timestamp::abstime and timestamp < ".($timestamp+$interval)."::abstime -group by ip) as tx, - -(SELECT ip, max(total/sample_duration)*8 as scale, sum(total) as total, sum(tcp) as tcp, sum(udp) as udp, sum(icmp) as icmp, -sum(http) as http, sum(p2p) as p2p, sum(ftp) as ftp -from sensors, bd_rx_log -where sensor_name = '$sensor_name' -and sensors.sensor_id = bd_rx_log.sensor_id -$sql_subnet -and timestamp > $timestamp::abstime and timestamp < ".($timestamp+$interval)."::abstime -group by ip) as rx - -where tx.ip = rx.ip -order by total desc;"; - -//echo "
$sql
"; exit(0); -pg_query("SET sort_mem TO 30000;"); -$result = pg_query($sql); -pg_query("set sort_mem to default;"); - -if ($limit == "all") - $limit = pg_num_rows($result); - -echo "
IpNameTotalSentReceivedtcpudpicmphttpsmtpftp"; - -if (!isset($subnet)) // Set this now for total graphs - $subnet = "0.0.0.0/0"; - -// Output Total Line -echo "
Total$subnet"; -foreach (array("total", "sent", "received", "tcp", "udp", "icmp", "http", "p2p", "ftp") as $key) - { - for($Counter=0, $Total = 0; $Counter < pg_num_rows($result); $Counter++) - { - $r = pg_fetch_array($result, $Counter); - $Total += $r[$key]; - } - echo fmtb($Total); - } -echo "\n"; - -// Output Other Lines -for($Counter=0; $Counter < pg_num_rows($result) && $Counter < $limit; $Counter++) - { - $r = pg_fetch_array($result, $Counter); - echo "
"; - echo $r['ip']."".gethostbyaddr($r['ip']); - echo ""; - echo fmtb($r['total']).fmtb($r['sent']).fmtb($r['received']). - fmtb($r['tcp']).fmtb($r['udp']).fmtb($r['icmp']).fmtb($r['http']). - fmtb($r['p2p']).fmtb($r['ftp'])."\n"; - } -echo "
"; - -// Output Total Graph -for($Counter=0, $Total = 0; $Counter < pg_num_rows($result); $Counter++) - { - $r = pg_fetch_array($result, $Counter); - $scale = max($r['txscale'], $scale); - $scale = max($r['rxscale'], $scale); - } - -if ($subnet == "0.0.0.0/0") - $total_table = "bd_tx_total_log"; -else - $total_table = "bd_tx_log"; -echo "

"; -echo "Total - Total of $subnet

"; -echo ""; -echo "Send:

"; -echo "
\n"; -if ($subnet == "0.0.0.0/0") - $total_table = "bd_rx_total_log"; -else - $total_table = "bd_rx_log"; -echo "Receive:

"; -echo "
\n"; - - -// Output Other Graphs -for($Counter=0; $Counter < pg_num_rows($result) && $Counter < $limit; $Counter++) - { - $r = pg_fetch_array($result, $Counter); - echo "

"; - if ($r['ip'] == "0.0.0.0") - echo "Total - Total of all subnets

"; - else - echo $r['ip']." - ".gethostbyaddr($r['ip']).""; - echo ""; - echo "Send:

"; - echo "
\n"; - echo "Receive:

"; - echo "
\n"; - } - -include('footer.php'); diff --git a/utils/bandwidthd/patches/010-dont-add-host-paths-in-config.in.patch b/utils/bandwidthd/patches/010-dont-add-host-paths-in-config.in.patch deleted file mode 100644 index cfaba70bd4..0000000000 --- a/utils/bandwidthd/patches/010-dont-add-host-paths-in-config.in.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/configure.in -+++ b/configure.in -@@ -24,11 +24,6 @@ if test -n "$x_libraries" && test "x$x_l - LDFLAGS="$LDFLAGS -L$x_libraries" - fi - --# May be equired for BSD --LDFLAGS="$LDFLAGS -L/usr/local/lib" -- --CPPFLAGS="$CPPFLAGS -I/usr/local/include" -- - #Check for Darwin sw directory - AC_CHECK_FILE(/sw/lib, LDFLAGS="$LDFLAGS -L/sw/lib") - AC_CHECK_FILE(/sw/include, CPPFLAGS="$CPPFLAGS -I/sw/include") -@@ -55,8 +50,7 @@ AC_CHECK_LIB(pcap, pcap_open_live, , - [AC_CHECK_LIB(wpcap, pcap_open_live, ,[AC_MSG_ERROR([Bandwidthd requires but cannot find libpcap])])]) - - # Optional Library --AC_CHECK_FILE(/usr/lib, LDFLAGS="$LDFLAGS -L/usr/lib") --AC_CHECK_FILE(/usr/include/pgsql, CPPFLAGS="$CPPFLAGS -I/usr/include/pgsql") -+AC_CHECK_FILE(/usr/local/pgsql/include, CPPFLAGS="$CPPFLAGS -I/usr/local/pgsql/include") - AC_CHECK_LIB(pq, PQconnectdb, - [AC_CHECK_LIB(pq,PQexecParams, ,AC_MSG_WARN([libpq exists but is too old... bandwidthd requires support for PQexecParams]))]) - AC_CHECK_LIB(sqlite3, sqlite3_open, ,AC_MSG_WARN([sqlite3 is recommended for storage of data but cannot be found])) diff --git a/utils/bandwidthd/patches/020-change-p2p-to-smtp.patch b/utils/bandwidthd/patches/020-change-p2p-to-smtp.patch deleted file mode 100644 index d0e614476a..0000000000 --- a/utils/bandwidthd/patches/020-change-p2p-to-smtp.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/graph.c -+++ b/graph.c -@@ -274,7 +274,7 @@ void MakeIndexPages(int NumIps, struct S - - // PASS 1: Write out the table - -- fprintf(file, "Ip and NameTotalTotal SentTotal ReceivedFTPHTTPP2PTCPUDPICMP\n"); -+ fprintf(file, "Ip and NameTotalTotal SentTotal ReceivedFTPHTTPSMTPTCPUDPICMP\n"); - for (Counter=0; Counter < 21 && Counter < NumIps; Counter++) - PrintTableLine(file, SummaryData[Counter], Counter); - -@@ -341,7 +341,7 @@ void MakeIndexPages(int NumIps, struct S - - // PASS 1: Write out the table - -- fprintf(file, "Ip and NameTotalTotal SentTotal ReceivedFTPHTTPP2PTCPUDPICMP\n"); -+ fprintf(file, "Ip and NameTotalTotal SentTotal ReceivedFTPHTTPSMTPTCPUDPICMP\n"); - for (tCounter=0, Counter=0; Counter < NumIps; Counter++) - { - if (SubnetTable[SubnetCounter].ip == (SummaryData[Counter]->IP & SubnetTable[SubnetCounter].mask)) diff --git a/utils/bandwidthd/patches/030-gcc10.patch b/utils/bandwidthd/patches/030-gcc10.patch deleted file mode 100644 index 04d3ce0e9e..0000000000 --- a/utils/bandwidthd/patches/030-gcc10.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/bandwidthd.h -+++ b/bandwidthd.h -@@ -120,7 +120,7 @@ struct config - char *sensor_id; - }; - --struct SubnetData -+extern struct SubnetData - { - uint32_t ip; - uint32_t mask; -@@ -139,7 +139,7 @@ struct Statistics - unsigned long long p2p; - }; - --struct IPData -+extern struct IPData - { - time_t timestamp; - uint32_t ip; // Host byte order diff --git a/utils/bandwidthd/patches/040-64bit-time-t.patch b/utils/bandwidthd/patches/040-64bit-time-t.patch deleted file mode 100644 index f0ddd586e4..0000000000 --- a/utils/bandwidthd/patches/040-64bit-time-t.patch +++ /dev/null @@ -1,114 +0,0 @@ ---- a/bandwidthd.c -+++ b/bandwidthd.c -@@ -103,7 +103,7 @@ void bd_CollectingData(char *filename) - } - } - --int WriteOutWebpages(long int timestamp) -+int WriteOutWebpages(time_t timestamp) - { - struct IPDataStore *DataStore = IPDataStore; - struct SummaryData **SummaryData; -@@ -893,7 +893,7 @@ void StoreIPDataInCDF(struct IPData IncD - { - IPData = &IncData[counter]; - HostIp2CharIp(IPData->ip, IPBuffer); -- fprintf(cdf, "%s,%lu,", IPBuffer, IPData->timestamp); -+ fprintf(cdf, "%s,%" PRId64 ",", IPBuffer, IPData->timestamp); - Stats = &(IPData->Send); - fprintf(cdf, "%llu,%llu,%llu,%llu,%llu,%llu,%llu,", Stats->total, Stats->icmp, Stats->udp, Stats->tcp, Stats->ftp, Stats->http, Stats->p2p); - Stats = &(IPData->Receive); -@@ -1089,7 +1089,7 @@ int RCDF_Test(char *filename) - if (fseek(cdf, -2, SEEK_CUR) == -1) - break; - } -- if(fscanf(cdf, " %15[0-9.],%lu,", ipaddrBuffer, ×tamp) != 2) -+ if(fscanf(cdf, " %15[0-9.],%" PRId64 ",", ipaddrBuffer, ×tamp) != 2) - { - syslog(LOG_ERR, "%s is corrupted, skipping", filename); - return FALSE; -@@ -1122,7 +1122,7 @@ void RCDF_PositionStream(FILE *cdf) - } - while (fgetc(cdf) != '\n' && !feof(cdf)); // Read to next line - ungetc('\n', cdf); // Just so the fscanf mask stays identical -- if(fscanf(cdf, " %15[0-9.],%lu,", ipaddrBuffer, ×tamp) != 2) -+ if(fscanf(cdf, " %15[0-9.],%" PRId64 ",", ipaddrBuffer, ×tamp) != 2) - { - syslog(LOG_ERR, "Unknown error while scanning for beginning of data...\n"); - return; -@@ -1144,7 +1144,7 @@ void RCDF_Load(FILE *cdf) - - for(Counter = 0; !feof(cdf) && !ferror(cdf); Counter++) - { -- if(fscanf(cdf, " %15[0-9.],%lu,", ipaddrBuffer, ×tamp) != 2) -+ if(fscanf(cdf, " %15[0-9.],%" PRId64 ",", ipaddrBuffer, ×tamp) != 2) - goto End_RecoverDataFromCdf; - - if (!timestamp) // First run through loop ---- a/graph.c -+++ b/graph.c -@@ -767,8 +767,8 @@ void PrepareXAxis(gdImagePtr im, time_t - int black, red; - time_t sample_begin, sample_end; - struct tm *timestruct; -- long int MarkTime; -- long int MarkTimeStep; -+ time_t MarkTime; -+ time_t MarkTimeStep; - double x; - - sample_begin=timestamp-config.range; -@@ -786,7 +786,7 @@ void PrepareXAxis(gdImagePtr im, time_t - if ((24*60*60*(XWIDTH-XOFFSET))/config.range > (XWIDTH-XOFFSET)/10) - { - // Day bars -- timestruct = localtime((time_t *)&sample_begin); -+ timestruct = localtime(&sample_begin); - timestruct->tm_sec = 0; - timestruct->tm_min = 0; - timestruct->tm_hour = 0; -@@ -805,7 +805,7 @@ void PrepareXAxis(gdImagePtr im, time_t - gdImageLine(im, x, 0, x, YHEIGHT-YOFFSET, red); - gdImageLine(im, x+1, 0, x+1, YHEIGHT-YOFFSET, red); - -- timestruct = localtime((time_t *)&MarkTime); -+ timestruct = localtime(&MarkTime); - strftime(buffer, 100, "%a, %b %d", timestruct); - gdImageString(im, gdFontSmall, x-30, YHEIGHT-YOFFSET+10, buffer, black); - -@@ -817,7 +817,7 @@ void PrepareXAxis(gdImagePtr im, time_t - else - { - // Month Bars -- timestruct = localtime((time_t *)&sample_begin); -+ timestruct = localtime(&sample_begin); - timestruct->tm_sec = 0; - timestruct->tm_min = 0; - timestruct->tm_hour = 0; -@@ -839,7 +839,7 @@ void PrepareXAxis(gdImagePtr im, time_t - gdImageLine(im, x, 0, x, YHEIGHT-YOFFSET, red); - gdImageLine(im, x+1, 0, x+1, YHEIGHT-YOFFSET, red); - -- timestruct = localtime((time_t *)&MarkTime); -+ timestruct = localtime(&MarkTime); - strftime(buffer, 100, "%b", timestruct); - gdImageString(im, gdFontSmall, x-6, YHEIGHT-YOFFSET+10, buffer, black); - -@@ -854,7 +854,7 @@ void PrepareXAxis(gdImagePtr im, time_t - // **** Write the tic marks - // ******************************************************************** - -- timestruct = localtime((time_t *)&sample_begin); -+ timestruct = localtime(&sample_begin); - timestruct->tm_sec = 0; - timestruct->tm_min = 0; - timestruct->tm_hour = 0; -@@ -884,7 +884,7 @@ void PrepareXAxis(gdImagePtr im, time_t - x = (MarkTime-sample_begin)*((XWIDTH-XOFFSET)/config.range) + XOFFSET; - } - -- timestruct = localtime((time_t *)&sample_begin); -+ timestruct = localtime(&sample_begin); - timestruct->tm_sec = 0; - timestruct->tm_min = 0; - timestruct->tm_hour = 0;