Merge branch 'openwrt:master' into master
This commit is contained in:
commit
8bba75cb39
47 changed files with 68 additions and 2443 deletions
|
@ -25,7 +25,7 @@ include $(INCLUDE_DIR)/package.mk
|
||||||
define KernelPackage/ovpn-dco-v2
|
define KernelPackage/ovpn-dco-v2
|
||||||
SUBMENU:=Network Support
|
SUBMENU:=Network Support
|
||||||
TITLE:=OpenVPN data channel offload
|
TITLE:=OpenVPN data channel offload
|
||||||
DEPENDS:=+kmod-crypto-aead +kmod-udptunnel4 +kmod-udptunnel6
|
DEPENDS:=+kmod-crypto-aead +kmod-udptunnel4 +IPV6:kmod-udptunnel6
|
||||||
FILES:=$(PKG_BUILD_DIR)/drivers/net/ovpn-dco/ovpn-dco-v2.ko
|
FILES:=$(PKG_BUILD_DIR)/drivers/net/ovpn-dco/ovpn-dco-v2.ko
|
||||||
AUTOLOAD:=$(call AutoLoad,30,ovpn-dco-v2)
|
AUTOLOAD:=$(call AutoLoad,30,ovpn-dco-v2)
|
||||||
endef
|
endef
|
||||||
|
|
|
@ -8,12 +8,12 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=perl-cgi
|
PKG_NAME:=perl-cgi
|
||||||
PKG_VERSION:=4.56
|
PKG_VERSION:=4.57
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE_URL:=https://www.cpan.org/authors/id/L/LE/LEEJO
|
PKG_SOURCE_URL:=https://www.cpan.org/authors/id/L/LE/LEEJO
|
||||||
PKG_SOURCE:=CGI-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=CGI-$(PKG_VERSION).tar.gz
|
||||||
PKG_HASH:=2d36d930b89ecdfbcc7d6d4740821bd466a0218abf1bd413568640b2f43799b7
|
PKG_HASH:=4e6ca634fe0d5621bb55b0fce5c1d08e6f643c65eecdfffbb4b344fd51b963ac
|
||||||
PKG_BUILD_DIR:=$(BUILD_DIR)/perl/CGI-$(PKG_VERSION)
|
PKG_BUILD_DIR:=$(BUILD_DIR)/perl/CGI-$(PKG_VERSION)
|
||||||
|
|
||||||
PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>, \
|
PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>, \
|
||||||
|
|
|
@ -8,12 +8,12 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=perl-text-csv_xs
|
PKG_NAME:=perl-text-csv_xs
|
||||||
PKG_VERSION:=1.50
|
PKG_VERSION:=1.51
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE:=Text-CSV_XS-$(PKG_VERSION).tgz
|
PKG_SOURCE:=Text-CSV_XS-$(PKG_VERSION).tgz
|
||||||
PKG_SOURCE_URL:=https://cpan.metacpan.org/authors/id/H/HM/HMBRAND
|
PKG_SOURCE_URL:=https://cpan.metacpan.org/authors/id/H/HM/HMBRAND
|
||||||
PKG_HASH:=85b5e1bed7e11dc0413d4e920cee25d980de47376c0048029041cf461eac96b1
|
PKG_HASH:=b1831d4d5f90ec6ad7f111a2e4bc5ca6dce7d17d7e57f17ace42b0f3ca140372
|
||||||
PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Text-CSV_XS-$(PKG_VERSION)
|
PKG_BUILD_DIR:=$(BUILD_DIR)/perl/Text-CSV_XS-$(PKG_VERSION)
|
||||||
|
|
||||||
PKG_MAINTAINER:=Philip Prindeville <philipp@redfish-solutions.com>
|
PKG_MAINTAINER:=Philip Prindeville <philipp@redfish-solutions.com>
|
||||||
|
|
|
@ -9,12 +9,12 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=ffmpeg
|
PKG_NAME:=ffmpeg
|
||||||
PKG_VERSION:=5.1.2
|
PKG_VERSION:=5.1.3
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||||
PKG_SOURCE_URL:=https://ffmpeg.org/releases/
|
PKG_SOURCE_URL:=https://ffmpeg.org/releases/
|
||||||
PKG_HASH:=619e706d662c8420859832ddc259cd4d4096a48a2ce1eefd052db9e440eef3dc
|
PKG_HASH:=1b113593ff907293be7aed95acdda5e785dd73616d7d4ec90a0f6adbc5a0312e
|
||||||
PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>, \
|
PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>, \
|
||||||
Ian Leonard <antonlacon@gmail.com>
|
Ian Leonard <antonlacon@gmail.com>
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=aardvark-dns
|
PKG_NAME:=aardvark-dns
|
||||||
PKG_VERSION:=1.6.0
|
PKG_VERSION:=1.7.0
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=https://codeload.github.com/containers/aardvark-dns/tar.gz/v$(PKG_VERSION)?
|
PKG_SOURCE_URL:=https://codeload.github.com/containers/aardvark-dns/tar.gz/v$(PKG_VERSION)?
|
||||||
PKG_HASH:=f3a2ff2d7baf07d8bf2785b6f1c9618db8aa188bd738b7f5cf1b0a31848232f5
|
PKG_HASH:=6ee7dfa8bab8040b917959a2f57f25496ad036a2d933c6225114e2c1e68bab0b
|
||||||
|
|
||||||
PKG_MAINTAINER:=Oskari Rauta <oskari.rauta@gmail.com>
|
PKG_MAINTAINER:=Oskari Rauta <oskari.rauta@gmail.com>
|
||||||
PKG_LICENSE:=Apache-2.0
|
PKG_LICENSE:=Apache-2.0
|
||||||
|
|
|
@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=adblock-fast
|
PKG_NAME:=adblock-fast
|
||||||
PKG_VERSION:=1.0.0
|
PKG_VERSION:=1.0.0
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=2
|
||||||
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca>
|
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca>
|
||||||
PKG_LICENSE:=GPL-3.0-or-later
|
PKG_LICENSE:=GPL-3.0-or-later
|
||||||
|
|
||||||
|
|
|
@ -1124,7 +1124,7 @@ adb_allow() {
|
||||||
for c in $string; do
|
for c in $string; do
|
||||||
output 2 " $c "
|
output 2 " $c "
|
||||||
hf="$(echo "$c" | sed 's/\./\\./g')"
|
hf="$(echo "$c" | sed 's/\./\\./g')"
|
||||||
if sed -i "/(^|\.)${hf}$/d;" "$outputFile" && \
|
if sed -i "/\(^\|\.\)${hf}$/d;" "$outputFile" && \
|
||||||
uci_add_list_if_new "${packageName}" 'config' 'allowed_domain' "$c"; then
|
uci_add_list_if_new "${packageName}" 'config' 'allowed_domain' "$c"; then
|
||||||
output_ok
|
output_ok
|
||||||
else
|
else
|
||||||
|
|
|
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||||
include $(INCLUDE_DIR)/nls.mk
|
include $(INCLUDE_DIR)/nls.mk
|
||||||
|
|
||||||
PKG_NAME:=curl
|
PKG_NAME:=curl
|
||||||
PKG_VERSION:=8.2.1
|
PKG_VERSION:=8.3.0
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||||
|
@ -17,7 +17,7 @@ PKG_SOURCE_URL:=https://github.com/curl/curl/releases/download/curl-$(subst .,_,
|
||||||
https://dl.uxnr.de/mirror/curl/ \
|
https://dl.uxnr.de/mirror/curl/ \
|
||||||
https://curl.askapache.com/download/ \
|
https://curl.askapache.com/download/ \
|
||||||
https://curl.se/download/
|
https://curl.se/download/
|
||||||
PKG_HASH:=dd322f6bd0a20e6cebdfd388f69e98c3d183bed792cf4713c8a7ef498cba4894
|
PKG_HASH:=376d627767d6c4f05105ab6d497b0d9aba7111770dd9d995225478209c37ea63
|
||||||
|
|
||||||
PKG_LICENSE:=MIT
|
PKG_LICENSE:=MIT
|
||||||
PKG_LICENSE_FILES:=COPYING
|
PKG_LICENSE_FILES:=COPYING
|
||||||
|
|
|
@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=https-dns-proxy
|
PKG_NAME:=https-dns-proxy
|
||||||
PKG_VERSION:=2023-05-25
|
PKG_VERSION:=2023-05-25
|
||||||
PKG_RELEASE:=4
|
PKG_RELEASE:=5
|
||||||
|
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_URL:=https://github.com/aarond10/https_dns_proxy/
|
PKG_SOURCE_URL:=https://github.com/aarond10/https_dns_proxy/
|
||||||
|
@ -45,8 +45,8 @@ define Package/https-dns-proxy/install
|
||||||
$(SED) "s|^\(readonly PKG_VERSION\).*|\1='$(PKG_VERSION)-$(PKG_RELEASE)'|" $(1)/etc/init.d/https-dns-proxy
|
$(SED) "s|^\(readonly PKG_VERSION\).*|\1='$(PKG_VERSION)-$(PKG_RELEASE)'|" $(1)/etc/init.d/https-dns-proxy
|
||||||
$(INSTALL_DIR) $(1)/etc/config
|
$(INSTALL_DIR) $(1)/etc/config
|
||||||
$(INSTALL_CONF) ./files/etc/config/https-dns-proxy $(1)/etc/config/https-dns-proxy
|
$(INSTALL_CONF) ./files/etc/config/https-dns-proxy $(1)/etc/config/https-dns-proxy
|
||||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/online
|
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
||||||
$(INSTALL_DATA) ./files/etc/hotplug.d/online/30-https-dns-proxy $(1)/etc/hotplug.d/online/30-https-dns-proxy
|
$(INSTALL_DATA) ./files/etc/hotplug.d/iface/90-https-dns-proxy $(1)/etc/hotplug.d/iface/90-https-dns-proxy
|
||||||
$(INSTALL_DIR) $(1)/etc/uci-defaults/
|
$(INSTALL_DIR) $(1)/etc/uci-defaults/
|
||||||
$(INSTALL_BIN) ./files/etc/uci-defaults/50-https-dns-proxy-migrate-options.sh $(1)/etc/uci-defaults/50-https-dns-proxy-migrate-options.sh
|
$(INSTALL_BIN) ./files/etc/uci-defaults/50-https-dns-proxy-migrate-options.sh $(1)/etc/uci-defaults/50-https-dns-proxy-migrate-options.sh
|
||||||
endef
|
endef
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Copied from https://openwrt.org/docs/guide-user/advanced/hotplug_extras
|
||||||
|
# shellcheck disable=SC1091
|
||||||
|
. /lib/functions/network.sh
|
||||||
|
network_flush_cache
|
||||||
|
network_find_wan NET_IF
|
||||||
|
network_find_wan6 NET_IF6
|
||||||
|
[ "$INTERFACE" != "$NET_IF" ] && [ "$INTERFACE" != "$NET_IF6" ] && exit 0
|
||||||
|
[ "$ACTION" != "ifup" ] && [ "$ACTION" != "ifupdate" ] && exit 0
|
||||||
|
[ "$ACTION" = "ifupdate" ] && [ -z "$IFUPDATE_ADDRESSES" ] && \
|
||||||
|
[ -z "$IFUPDATE_DATA" ] && exit 0
|
||||||
|
|
||||||
|
sleep 10
|
||||||
|
/etc/init.d/https-dns-proxy start 'on_hotplug'
|
|
@ -1,2 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
/etc/init.d/https-dns-proxy start 'on_hotplug'
|
|
|
@ -8,12 +8,12 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=iperf
|
PKG_NAME:=iperf
|
||||||
PKG_VERSION:=3.14
|
PKG_VERSION:=3.15
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=https://downloads.es.net/pub/iperf
|
PKG_SOURCE_URL:=https://downloads.es.net/pub/iperf
|
||||||
PKG_HASH:=723fcc430a027bc6952628fa2a3ac77584a1d0bd328275e573fc9b206c155004
|
PKG_HASH:=bdb77c11f72bce90214883159577fa24412013e62b2083cf5f54391d79b1d8ff
|
||||||
|
|
||||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||||
PKG_LICENSE:=BSD-3-Clause
|
PKG_LICENSE:=BSD-3-Clause
|
||||||
|
|
|
@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
|
||||||
PKG_NAME:=isc-dhcp
|
PKG_NAME:=isc-dhcp
|
||||||
UPSTREAM_NAME:=dhcp
|
UPSTREAM_NAME:=dhcp
|
||||||
PKG_VERSION:=4.4.3-P1
|
PKG_VERSION:=4.4.3-P1
|
||||||
PKG_RELEASE:=5
|
PKG_RELEASE:=6
|
||||||
|
|
||||||
PKG_LICENSE:=BSD-3-Clause
|
PKG_LICENSE:=BSD-3-Clause
|
||||||
PKG_LICENSE_FILES:=LICENSE
|
PKG_LICENSE_FILES:=LICENSE
|
||||||
|
|
|
@ -294,17 +294,17 @@ static_host_add() {
|
||||||
for option in $force_send; do
|
for option in $force_send; do
|
||||||
case "$option" in
|
case "$option" in
|
||||||
hostname)
|
hostname)
|
||||||
extra_options="$extra_options${extra_options:+ }0c" ;;
|
extra_options="$extra_options${extra_options:+,}0c" ;;
|
||||||
domain-name)
|
domain-name)
|
||||||
extra_options="$extra_options${extra_options:+ }0f" ;;
|
extra_options="$extra_options${extra_options:+,}0f" ;;
|
||||||
renewal-time)
|
renewal-time)
|
||||||
extra_options="$extra_options${extra_options:+ }3a" ;;
|
extra_options="$extra_options${extra_options:+,}3a" ;;
|
||||||
rebinding-time)
|
rebinding-time)
|
||||||
extra_options="$extra_options${extra_options:+ }3b" ;;
|
extra_options="$extra_options${extra_options:+,}3b" ;;
|
||||||
fqdn)
|
fqdn)
|
||||||
extra_options="$extra_options${extra_options:+ }51" ;;
|
extra_options="$extra_options${extra_options:+,}51" ;;
|
||||||
routes)
|
routes)
|
||||||
extra_options="$extra_options${extra_options:+ }79" ;;
|
extra_options="$extra_options${extra_options:+,}79" ;;
|
||||||
*)
|
*)
|
||||||
echo "unknown option: $option" >&2 ;;
|
echo "unknown option: $option" >&2 ;;
|
||||||
esac
|
esac
|
||||||
|
@ -393,6 +393,8 @@ gen_dhcp_subnet() {
|
||||||
fi
|
fi
|
||||||
echo " option domain-name-servers $DNS;"
|
echo " option domain-name-servers $DNS;"
|
||||||
|
|
||||||
|
[ -n "$domain" ] && echo " option domain-name \"$domain\";"
|
||||||
|
|
||||||
local routes=
|
local routes=
|
||||||
config_list_foreach "$cfg" "routes" append_routes
|
config_list_foreach "$cfg" "routes" append_routes
|
||||||
[ -n "$routes" ] && echo " option classless-ipv4-route $routes;"
|
[ -n "$routes" ] && echo " option classless-ipv4-route $routes;"
|
||||||
|
@ -405,7 +407,7 @@ dhcpd_add() {
|
||||||
local cfg="$1" synthesize="$2"
|
local cfg="$1" synthesize="$2"
|
||||||
local dhcp6range="::"
|
local dhcp6range="::"
|
||||||
local dynamicdhcp defaultroute end gateway ifname ignore leasetime limit net netmask
|
local dynamicdhcp defaultroute end gateway ifname ignore leasetime limit net netmask
|
||||||
local proto networkid start subnet
|
local proto networkid start subnet domain
|
||||||
local IP NETMASK BROADCAST NETWORK PREFIX DNS START END
|
local IP NETMASK BROADCAST NETWORK PREFIX DNS START END
|
||||||
|
|
||||||
config_get_bool ignore "$cfg" "ignore" 0
|
config_get_bool ignore "$cfg" "ignore" 0
|
||||||
|
@ -462,6 +464,8 @@ dhcpd_add() {
|
||||||
gateway="$IP"
|
gateway="$IP"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
config_get domain "$cfg" "domain"
|
||||||
|
|
||||||
gen_dhcp_subnet "$cfg"
|
gen_dhcp_subnet "$cfg"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,12 +8,12 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=knot
|
PKG_NAME:=knot
|
||||||
PKG_VERSION:=3.3.0
|
PKG_VERSION:=3.3.1
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||||
PKG_SOURCE_URL:=https://secure.nic.cz/files/knot-dns/
|
PKG_SOURCE_URL:=https://secure.nic.cz/files/knot-dns/
|
||||||
PKG_HASH:=cf12ab736c512eb719a221cd3f65bb94f93ff2b477803d9474d1334af73c1533
|
PKG_HASH:=f3f4b1d49ec9b81113b14a38354b823bd4a470356ed7e8e555595b6fd1ac80c9
|
||||||
|
|
||||||
PKG_MAINTAINER:=Daniel Salzman <daniel.salzman@nic.cz>
|
PKG_MAINTAINER:=Daniel Salzman <daniel.salzman@nic.cz>
|
||||||
PKG_LICENSE:=GPL-3.0 LGPL-2.0 0BSD BSD-3-Clause OLDAP-2.8
|
PKG_LICENSE:=GPL-3.0 LGPL-2.0 0BSD BSD-3-Clause OLDAP-2.8
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=netavark
|
PKG_NAME:=netavark
|
||||||
PKG_VERSION:=1.6.0
|
PKG_VERSION:=1.7.0
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=https://codeload.github.com/containers/netavark/tar.gz/v$(PKG_VERSION)?
|
PKG_SOURCE_URL:=https://codeload.github.com/containers/netavark/tar.gz/v$(PKG_VERSION)?
|
||||||
PKG_HASH:=3bec9e9b0f3f8f857370900010fb2125ead462d43998ad8f43e4387a5b06f9d6
|
PKG_HASH:=b0ed7d80fd96ef2af88e7a001d91024919125e5842d9772de94648044630e116
|
||||||
|
|
||||||
PKG_MAINTAINER:=Oskari Rauta <oskari.rauta@gmail.com>
|
PKG_MAINTAINER:=Oskari Rauta <oskari.rauta@gmail.com>
|
||||||
PKG_LICENSE:=Apache-2.0
|
PKG_LICENSE:=Apache-2.0
|
||||||
|
|
|
@ -6,12 +6,12 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=rclone
|
PKG_NAME:=rclone
|
||||||
PKG_VERSION:=1.63.1
|
PKG_VERSION:=1.64.0
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=https://codeload.github.com/rclone/rclone/tar.gz/v$(PKG_VERSION)?
|
PKG_SOURCE_URL:=https://codeload.github.com/rclone/rclone/tar.gz/v$(PKG_VERSION)?
|
||||||
PKG_HASH:=84b2b2206abc3cb56056c0b76cceefecef0b5f6ad86b208ca458675632f0edf6
|
PKG_HASH:=3297838fdcf611a5ad605835f41c0e51031ce9f220c77a4ad0af6283b7805329
|
||||||
|
|
||||||
PKG_LICENSE:=MIT
|
PKG_LICENSE:=MIT
|
||||||
PKG_LICENSE_FILES:=LICENSE
|
PKG_LICENSE_FILES:=LICENSE
|
||||||
|
|
|
@ -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 <lacroix@lepine-lacroix.info>
|
|
||||||
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))
|
|
|
@ -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"
|
|
|
@ -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'
|
|
|
@ -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="<?php\n// auto-generated config file from /etc/config/${CONFIGNAME}\n"
|
|
||||||
rm -f $CONFIGFILE
|
|
||||||
touch $CONFIGFILE
|
|
||||||
|
|
||||||
config_load $CONFIGNAME
|
|
||||||
for cfg in $cfgs; do
|
|
||||||
export_number dflt_width $cfg
|
|
||||||
conffile="${conffile}define(\"DFLT_WIDTH\", ${paramstr:-"900"});\n"
|
|
||||||
|
|
||||||
export_number dflt_height $cfg
|
|
||||||
conffile="${conffile}define(\"DFLT_HEIGHT\", ${paramstr:-"256"});\n"
|
|
||||||
|
|
||||||
export_string dflt_interval $cfg
|
|
||||||
conffile="${conffile}define(\"DFLT_INTERVAL\", ${paramstr:-"INT_DAILY"});\n\n"'$db_connect_string = "host='
|
|
||||||
|
|
||||||
export_string host $cfg
|
|
||||||
conffile="${conffile}${paramstr:-"127.0.0.1"} user="
|
|
||||||
|
|
||||||
export_string user $cfg
|
|
||||||
conffile="${conffile}${paramstr:-"postgres"} dbname="
|
|
||||||
|
|
||||||
export_string dbname $cfg
|
|
||||||
conffile="${conffile}${paramstr:-"bandwidthd"}"'"'"\n?>"
|
|
||||||
[ -n "$conffile" ] && echo -e "$conffile" >>$CONFIGFILE
|
|
||||||
done
|
|
||||||
}
|
|
|
@ -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"
|
|
|
@ -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="<?php\n// auto-generated config file from /etc/config/${CONFIGPHPNAME}\n"
|
|
||||||
|
|
||||||
rm -f $CONFIGPHPFILE
|
|
||||||
touch $CONFIGPHPFILE
|
|
||||||
|
|
||||||
config_load $CONFIGPHPNAME
|
|
||||||
for cfg in $cfgs; do
|
|
||||||
export_number dflt_width $cfg
|
|
||||||
conffile="${conffile}define(\"DFLT_WIDTH\", ${paramstr:-"900"});\n"
|
|
||||||
|
|
||||||
export_number dflt_height $cfg
|
|
||||||
conffile="${conffile}define(\"DFLT_HEIGHT\", ${paramstr:-"256"});\n"
|
|
||||||
|
|
||||||
export_string dflt_interval $cfg
|
|
||||||
conffile="${conffile}define(\"DFLT_INTERVAL\", ${paramstr:-"INT_DAILY"});\n\n"'$db_connect_string = "sqlite:'
|
|
||||||
|
|
||||||
export_string sqlite_dbname $cfg
|
|
||||||
conffile="${conffile}${paramstr:-"/www/bandwidthd/stats.db"}"'"'"\n?>"
|
|
||||||
[ -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
|
|
||||||
}
|
|
|
@ -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
|
|
|
@ -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
|
|
||||||
}
|
|
Binary file not shown.
Before Width: | Height: | Size: 9.2 KiB |
|
@ -1,104 +0,0 @@
|
||||||
<?php
|
|
||||||
include("include.php");
|
|
||||||
?>
|
|
||||||
<html>
|
|
||||||
<center>
|
|
||||||
<img src=logo.gif>
|
|
||||||
<?php
|
|
||||||
if (isset($_GET['sensor_name']))
|
|
||||||
$sensor_name = $_GET['sensor_name'];
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo "<br>Please provide a sensor_name";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_GET['ip']))
|
|
||||||
$ip = $_GET['ip'];
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo "<br>Please provide an ip address";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "<h3>";
|
|
||||||
if (strpos($ip, "/") === FALSE)
|
|
||||||
echo "$ip - ".gethostbyaddr($ip)."</h3>";
|
|
||||||
else
|
|
||||||
echo "Total - $ip</h3>";
|
|
||||||
|
|
||||||
$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('</center><tt>%s</tt><center>', $sql);
|
|
||||||
$db = ConnectDb();
|
|
||||||
$result = $db->query($sql);
|
|
||||||
echo "<table width=100% border=1 cellspacing=0><tr><td>Ip<td>Name<td>Total<td>Sent<td>Received<td>tcp<td>udp<td>icmp<td>http<td>smtp<td>ftp";
|
|
||||||
$r = $result->fetch();
|
|
||||||
$db = NULL;
|
|
||||||
echo "<tr><td>";
|
|
||||||
if (strpos($ip, "/") === FALSE)
|
|
||||||
echo "$ip<td>".gethostbyaddr($ip);
|
|
||||||
else
|
|
||||||
echo "Total<td>$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 "</table></center>";
|
|
||||||
|
|
||||||
echo "<center><h4>Daily</h4></center>";
|
|
||||||
echo "Send:<br><img src=graph.php?ip=$ip&sensor_name=".$sensor_name."&table=$txtable&yscale=".(max($r['txscale'], $r['rxscale']))."><br>";
|
|
||||||
echo "<img src=legend.gif><br>";
|
|
||||||
echo "Receive:<br><img src=graph.php?ip=$ip&sensor_name=".$sensor_name."&table=$rxtable&yscale=".(max($r['txscale'], $r['rxscale']))."><br>";
|
|
||||||
echo "<img src=legend.gif><br>";
|
|
||||||
|
|
||||||
echo "<center><h4>Weekly</h4></center>";
|
|
||||||
echo "Send:<br><img src=graph.php?interval=".INT_WEEKLY."&ip=$ip&sensor_name=$sensor_name&table=$txtable&yscale=".(max($r['txscale'], $r['rxscale']))."><br>";
|
|
||||||
echo "<img src=legend.gif><br>";
|
|
||||||
echo "Receive:<br><img src=graph.php?interval=".INT_WEEKLY."&ip=$ip&sensor_name=$sensor_name&table=$rxtable&yscale=".(max($r['txscale'], $r['rxscale']))."><br>";
|
|
||||||
echo "<img src=legend.gif><br>";
|
|
||||||
|
|
||||||
echo "<center><h4>Monthly</h4></center>";
|
|
||||||
echo "Send:<br><img src=graph.php?interval=".INT_MONTHLY."&ip=$ip&sensor_name=$sensor_name&table=$txtable&yscale=".(max($r['txscale'], $r['rxscale']))."><br>";
|
|
||||||
echo "<img src=legend.gif><br>";
|
|
||||||
echo "Receive:<br><img src=graph.php?interval=".INT_MONTHLY."&ip=$ip&sensor_name=$sensor_name&table=$rxtable&yscale=".(max($r['txscale'], $r['rxscale']))."><br>";
|
|
||||||
echo "<img src=legend.gif><br>";
|
|
||||||
|
|
||||||
echo "<center><h4>Yearly</h4></center>";
|
|
||||||
echo "Send:<br><img src=graph.php?interval=".INT_YEARLY."&ip=$ip&sensor_name=$sensor_name&table=$txtable&yscale=".(max($r['txscale'], $r['rxscale']))."><br>";
|
|
||||||
echo "<img src=legend.gif><br>";
|
|
||||||
echo "Receive:<br><img src=graph.php?interval=".INT_YEARLY."&ip=$ip&sensor_name=$sensor_name&table=$rxtable&yscale=".(max($r['txscale'], $r['rxscale']))."><br>";
|
|
||||||
echo "<img src=legend.gif><br>";
|
|
|
@ -1,3 +0,0 @@
|
||||||
<?php
|
|
||||||
echo("Page load completed in ". (time() - $starttime) ." seconds");
|
|
||||||
?>
|
|
|
@ -1,455 +0,0 @@
|
||||||
<?php
|
|
||||||
require("include.php");
|
|
||||||
|
|
||||||
// Returns x location of any given timestamp
|
|
||||||
function ts2x($ts)
|
|
||||||
{
|
|
||||||
global $timestamp, $width, $interval;
|
|
||||||
return(($ts-$timestamp)*(($width-XOFFSET) / $interval) + XOFFSET);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we have multiple IP's in a result set we need to total the average of each IP's samples
|
|
||||||
function AverageAndAccumulate()
|
|
||||||
{
|
|
||||||
global $Count, $total, $icmp, $udp, $tcp, $ftp, $http, $p2p, $YMax;
|
|
||||||
global $a_total, $a_icmp, $a_udp, $a_tcp, $a_ftp, $a_http, $a_p2p;
|
|
||||||
|
|
||||||
foreach ($Count as $key => $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."<br>";
|
|
||||||
$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<br>";
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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);
|
|
|
@ -1,69 +0,0 @@
|
||||||
<?php
|
|
||||||
error_reporting(E_ALL & ~(E_NOTICE|E_STRICT));
|
|
||||||
define("INT_DAILY", 60*60*24*2);
|
|
||||||
define("INT_WEEKLY", 60*60*24*8);
|
|
||||||
define("INT_MONTHLY", 60*60*24*35);
|
|
||||||
define("INT_YEARLY", 60*60*24*400);
|
|
||||||
|
|
||||||
define("XOFFSET", 90);
|
|
||||||
define("YOFFSET", 45);
|
|
||||||
|
|
||||||
require("config.conf.php");
|
|
||||||
|
|
||||||
function ConnectDb() {
|
|
||||||
global $db_connect_string;
|
|
||||||
try {
|
|
||||||
$db = new PDO($db_connect_string);
|
|
||||||
} catch (PDOException $ex) {
|
|
||||||
die("DB Error, could not connect to database: " . $ex->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("<td align=right><tt>%.1f%s</td>", $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);
|
|
||||||
?>
|
|
|
@ -1,190 +0,0 @@
|
||||||
<?php
|
|
||||||
include("include.php");
|
|
||||||
?>
|
|
||||||
<html>
|
|
||||||
<center>
|
|
||||||
<img src=logo.gif>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$sensor_name = 'default';
|
|
||||||
|
|
||||||
// Get variables from url
|
|
||||||
|
|
||||||
if (isset($_GET['interval']) && $_GET['interval'] != "none")
|
|
||||||
$interval = $_GET['interval'];
|
|
||||||
|
|
||||||
if (isset($_GET['timestamp']) && $_GET['timestamp'] != "none")
|
|
||||||
$timestamp = $_GET['timestamp'];
|
|
||||||
|
|
||||||
if (isset($_GET['subnet']) && $_GET['subnet'] != "none")
|
|
||||||
$subnet = $_GET['subnet'];
|
|
||||||
|
|
||||||
if (isset($_GET['limit']) && $_GET['limit'] != "none")
|
|
||||||
$limit = $_GET['limit'];
|
|
||||||
|
|
||||||
|
|
||||||
$db = ConnectDb();
|
|
||||||
?>
|
|
||||||
<FORM name="navigation" method="get">
|
|
||||||
<table width=100% cellspacing=0 cellpadding=5 border=1>
|
|
||||||
<tr>
|
|
||||||
<td><SELECT name="interval">
|
|
||||||
<OPTION value="none">--Select An Interval--
|
|
||||||
<OPTION value=<?php echo INT_DAILY?> <?php echo $interval==INT_DAILY?"SELECTED":""?>>Daily
|
|
||||||
<OPTION value=<?php echo INT_WEEKLY?> <?php echo $interval==INT_WEEKLY?"SELECTED":""?>>Weekly
|
|
||||||
<OPTION value=<?php echo INT_MONTHLY?> <?php echo $interval==INT_MONTHLY?"SELECTED":""?>>Monthly
|
|
||||||
<OPTION value=<?php echo INT_YEARLY?> <?php echo $interval==INT_YEARLY?"SELECTED":""?>>Yearly
|
|
||||||
<OPTION value=<?php echo 24*60*60?> <?php echo $interval==24*60*60?"SELECTED":""?>>24hrs
|
|
||||||
<OPTION value=<?php echo 30*24*60*60?> <?php echo $interval==30*24*60*60?"SELECTED":""?>>30days
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<td><SELECT name="limit">
|
|
||||||
<OPTION value="none">--How Many Results--
|
|
||||||
<OPTION value=20 <?php echo $limit==20?"SELECTED":""?>>20
|
|
||||||
<OPTION value=50 <?php echo $limit==50?"SELECTED":""?>>50
|
|
||||||
<OPTION value=100 <?php echo $limit==100?"SELECTED":""?>>100
|
|
||||||
<OPTION value=all <?php echo $limit=="all"?"SELECTED":""?>>All
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<td>Subnet Filter:<input name=subnet value="<?php echo isset($subnet)?$subnet:"0.0.0.0/0"?>">
|
|
||||||
<input type=submit value="Go">
|
|
||||||
</table>
|
|
||||||
</FORM>
|
|
||||||
<?php
|
|
||||||
// Set defaults
|
|
||||||
if (!isset($interval))
|
|
||||||
$interval = DFLT_INTERVAL;
|
|
||||||
|
|
||||||
if (!isset($timestamp))
|
|
||||||
$timestamp = time() - $interval + (0.05*$interval);
|
|
||||||
|
|
||||||
if (!isset($limit))
|
|
||||||
$limit = 20;
|
|
||||||
|
|
||||||
// Validation
|
|
||||||
if (!isset($sensor_name))
|
|
||||||
exit(0);
|
|
||||||
|
|
||||||
// Print Title
|
|
||||||
|
|
||||||
if (isset($limit))
|
|
||||||
echo "<h2>Top $limit - $sensor_name</h2>";
|
|
||||||
else
|
|
||||||
echo "<h2>All Records - $sensor_name</h2>";
|
|
||||||
|
|
||||||
// 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 "</center><pre>$sql</pre><center>"; error_log($sql);
|
|
||||||
$pdoResult = $db->query($sql);
|
|
||||||
$result = $pdoResult->fetchAll();
|
|
||||||
$db = NULL;
|
|
||||||
$num_rows = count($result);
|
|
||||||
if ($limit == "all")
|
|
||||||
$limit = $num_rows;
|
|
||||||
|
|
||||||
echo "<table width=100% border=1 cellspacing=0><tr><td>Ip<td>Name<td>Total<td>Sent<td>Received<td>tcp<td>udp<td>icmp<td>http<td>smtp<td>ftp";
|
|
||||||
|
|
||||||
if (!isset($subnet)) // Set this now for total graphs
|
|
||||||
$subnet = "0.0.0.0/0";
|
|
||||||
|
|
||||||
// Output Total Line
|
|
||||||
echo "<TR><TD><a href=Total>Total</a><TD>$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 "<tr><td><a href=#".$r['ip'].">";
|
|
||||||
echo $r['ip']."<td>".gethostbyaddr($r['ip']);
|
|
||||||
echo "</a>";
|
|
||||||
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 "</table></center>";
|
|
||||||
|
|
||||||
// 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 "<a name=Total><h3><a href=details.php?sensor_name=$sensor_name&ip=$subnet>";
|
|
||||||
echo "Total - Total of $subnet</h3>";
|
|
||||||
echo "</a>";
|
|
||||||
echo "Send:<br><img src=graph.php?ip=$subnet&interval=$interval&sensor_name=".$sensor_name."&table=$total_table><br>";
|
|
||||||
echo "<img src=legend.gif><br>\n";
|
|
||||||
if ($subnet == "0.0.0.0/0")
|
|
||||||
$total_table = "bd_rx_total_log";
|
|
||||||
else
|
|
||||||
$total_table = "bd_rx_log";
|
|
||||||
echo "Receive:<br><img src=graph.php?ip=$subnet&interval=$interval&sensor_name=".$sensor_name."&table=$total_table><br>";
|
|
||||||
echo "<img src=legend.gif><br>\n";
|
|
||||||
|
|
||||||
|
|
||||||
// Output Other Graphs
|
|
||||||
for($Counter=0; $Counter < $num_rows && $Counter < $limit; $Counter++)
|
|
||||||
{
|
|
||||||
$r = $result[$Counter];
|
|
||||||
$r['ip'] = long2ip($r['ip']);
|
|
||||||
echo "<a name=".$r['ip']."><h3><a href=details.php?sensor_name=$sensor_name&ip=".$r['ip'].">";
|
|
||||||
if ($r['ip'] == "0.0.0.0")
|
|
||||||
echo "Total - Total of all subnets</h3>";
|
|
||||||
else
|
|
||||||
echo $r['ip']." - ".gethostbyaddr($r['ip'])."</h3>";
|
|
||||||
echo "</a>";
|
|
||||||
echo "Send:<br><img src=graph.php?ip=".$r['ip']."&interval=$interval&sensor_name=".$sensor_name."&table=bd_tx_log&yscale=".(max($r['txscale'], $r['rxscale']))."><br>";
|
|
||||||
echo "<img src=legend.gif><br>\n";
|
|
||||||
echo "Receive:<br><img src=graph.php?ip=".$r['ip']."&interval=$interval&sensor_name=".$sensor_name."&table=bd_rx_log&yscale=".(max($r['txscale'], $r['rxscale']))."><br>";
|
|
||||||
echo "<img src=legend.gif><br>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
include('footer.php');
|
|
|
@ -1,102 +0,0 @@
|
||||||
<?php
|
|
||||||
include("include.php");
|
|
||||||
?>
|
|
||||||
<html>
|
|
||||||
<center>
|
|
||||||
<img src=logo.gif>
|
|
||||||
<?php
|
|
||||||
if (isset($_GET['sensor_name']))
|
|
||||||
$sensor_name = $_GET['sensor_name'];
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo "<br>Please provide a sensor_name";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_GET['ip']))
|
|
||||||
$ip = $_GET['ip'];
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo "<br>Please provide an ip address";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "<h3>";
|
|
||||||
if (strpos($ip, "/") === FALSE)
|
|
||||||
echo "$ip - ".gethostbyaddr($ip)."</h3>";
|
|
||||||
else
|
|
||||||
echo "Total - $ip</h3>";
|
|
||||||
|
|
||||||
$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 "</center><pre>$sql</pre><center>";exit(0);
|
|
||||||
$result = pg_query($sql);
|
|
||||||
echo "<table width=100% border=1 cellspacing=0><tr><td>Ip<td>Name<td>Total<td>Sent<td>Received<td>tcp<td>udp<td>icmp<td>http<td>smtp<td>ftp";
|
|
||||||
$r = pg_fetch_array($result);
|
|
||||||
echo "<tr><td>";
|
|
||||||
if (strpos($ip, "/") === FALSE)
|
|
||||||
echo "$ip<td>".gethostbyaddr($ip);
|
|
||||||
else
|
|
||||||
echo "Total<td>$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 "</table></center>";
|
|
||||||
|
|
||||||
echo "<center><h4>Daily</h4></center>";
|
|
||||||
echo "Send:<br><img src=graph.php?ip=$ip&sensor_name=".$sensor_name."&table=$txtable&yscale=".(max($r['txscale'], $r['rxscale']))."><br>";
|
|
||||||
echo "<img src=legend.gif><br>";
|
|
||||||
echo "Receive:<br><img src=graph.php?ip=$ip&sensor_name=".$sensor_name."&table=$rxtable&yscale=".(max($r['txscale'], $r['rxscale']))."><br>";
|
|
||||||
echo "<img src=legend.gif><br>";
|
|
||||||
|
|
||||||
echo "<center><h4>Weekly</h4></center>";
|
|
||||||
echo "Send:<br><img src=graph.php?interval=".INT_WEEKLY."&ip=$ip&sensor_name=$sensor_name&table=$txtable&yscale=".(max($r['txscale'], $r['rxscale']))."><br>";
|
|
||||||
echo "<img src=legend.gif><br>";
|
|
||||||
echo "Receive:<br><img src=graph.php?interval=".INT_WEEKLY."&ip=$ip&sensor_name=$sensor_name&table=$rxtable&yscale=".(max($r['txscale'], $r['rxscale']))."><br>";
|
|
||||||
echo "<img src=legend.gif><br>";
|
|
||||||
|
|
||||||
echo "<center><h4>Monthly</h4></center>";
|
|
||||||
echo "Send:<br><img src=graph.php?interval=".INT_MONTHLY."&ip=$ip&sensor_name=$sensor_name&table=$txtable&yscale=".(max($r['txscale'], $r['rxscale']))."><br>";
|
|
||||||
echo "<img src=legend.gif><br>";
|
|
||||||
echo "Receive:<br><img src=graph.php?interval=".INT_MONTHLY."&ip=$ip&sensor_name=$sensor_name&table=$rxtable&yscale=".(max($r['txscale'], $r['rxscale']))."><br>";
|
|
||||||
echo "<img src=legend.gif><br>";
|
|
||||||
|
|
||||||
echo "<center><h4>Yearly</h4></center>";
|
|
||||||
echo "Send:<br><img src=graph.php?interval=".INT_YEARLY."&ip=$ip&sensor_name=$sensor_name&table=$txtable&yscale=".(max($r['txscale'], $r['rxscale']))."><br>";
|
|
||||||
echo "<img src=legend.gif><br>";
|
|
||||||
echo "Receive:<br><img src=graph.php?interval=".INT_YEARLY."&ip=$ip&sensor_name=$sensor_name&table=$rxtable&yscale=".(max($r['txscale'], $r['rxscale']))."><br>";
|
|
||||||
echo "<img src=legend.gif><br>";
|
|
|
@ -1,3 +0,0 @@
|
||||||
<?php
|
|
||||||
echo("Page load completed in ". (time() - $starttime) ." seconds");
|
|
||||||
?>
|
|
|
@ -1,454 +0,0 @@
|
||||||
<?php
|
|
||||||
require("include.php");
|
|
||||||
|
|
||||||
// Returns x location of any given timestamp
|
|
||||||
function ts2x($ts)
|
|
||||||
{
|
|
||||||
global $timestamp, $width, $interval;
|
|
||||||
return(($ts-$timestamp)*(($width-XOFFSET) / $interval) + XOFFSET);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we have multiple IP's in a result set we need to total the average of each IP's samples
|
|
||||||
function AverageAndAccumulate()
|
|
||||||
{
|
|
||||||
global $Count, $total, $icmp, $udp, $tcp, $ftp, $http, $p2p, $YMax;
|
|
||||||
global $a_total, $a_icmp, $a_udp, $a_tcp, $a_ftp, $a_http, $a_p2p;
|
|
||||||
|
|
||||||
foreach ($Count as $key => $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."<br>"; 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."<br>";
|
|
||||||
$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<br>";
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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);
|
|
|
@ -1,54 +0,0 @@
|
||||||
<?php
|
|
||||||
define("INT_DAILY", 60*60*24*2);
|
|
||||||
define("INT_WEEKLY", 60*60*24*8);
|
|
||||||
define("INT_MONTHLY", 60*60*24*35);
|
|
||||||
define("INT_YEARLY", 60*60*24*400);
|
|
||||||
|
|
||||||
define("XOFFSET", 90);
|
|
||||||
define("YOFFSET", 45);
|
|
||||||
|
|
||||||
require("config.conf");
|
|
||||||
|
|
||||||
function ConnectDb()
|
|
||||||
{
|
|
||||||
global $db_connect_string;
|
|
||||||
|
|
||||||
$db = pg_pconnect($db_connect_string);
|
|
||||||
if (!$db)
|
|
||||||
{
|
|
||||||
printf("DB Error, could not connect to database");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
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("<td align=right><tt>%.1f%s</td>", $Output, $Suffix));
|
|
||||||
}
|
|
||||||
|
|
||||||
$starttime = time();
|
|
||||||
set_time_limit(300);
|
|
||||||
?>
|
|
|
@ -1,197 +0,0 @@
|
||||||
<?php
|
|
||||||
include("include.php");
|
|
||||||
?>
|
|
||||||
<html>
|
|
||||||
<center>
|
|
||||||
<img src=logo.gif>
|
|
||||||
<?php
|
|
||||||
// Get variables from url
|
|
||||||
|
|
||||||
if (isset($_GET['sensor_name']) && $_GET['sensor_name'] != "none")
|
|
||||||
$sensor_name = $_GET['sensor_name'];
|
|
||||||
|
|
||||||
if (isset($_GET['interval']) && $_GET['interval'] != "none")
|
|
||||||
$interval = $_GET['interval'];
|
|
||||||
|
|
||||||
if (isset($_GET['timestamp']) && $_GET['timestamp'] != "none")
|
|
||||||
$timestamp = $_GET['timestamp'];
|
|
||||||
|
|
||||||
if (isset($_GET['subnet']) && $_GET['subnet'] != "none")
|
|
||||||
$subnet = $_GET['subnet'];
|
|
||||||
|
|
||||||
if (isset($_GET['limit']) && $_GET['limit'] != "none")
|
|
||||||
$limit = $_GET['limit'];
|
|
||||||
|
|
||||||
|
|
||||||
$db = ConnectDb();
|
|
||||||
?>
|
|
||||||
<FORM name="navigation" method=get action=<?php echo $PHP_SELF?>>
|
|
||||||
<table width=100% cellspacing=0 cellpadding=5 border=1>
|
|
||||||
<tr>
|
|
||||||
<td><SELECT name="sensor_name">
|
|
||||||
|
|
||||||
<OPTION value="none">--Select A Sensor--
|
|
||||||
<?php
|
|
||||||
$sql = "SELECT sensor_name from sensors order by sensor_name;";
|
|
||||||
$result = pg_query($sql);
|
|
||||||
while ($r = pg_fetch_array($result))
|
|
||||||
echo "<option value=\"".$r['sensor_name']."\" ".($sensor_name==$r['sensor_name']?"SELECTED":"").">".$r['sensor_name']."\n";
|
|
||||||
?>
|
|
||||||
</SELECT>
|
|
||||||
<td><SELECT name="interval">
|
|
||||||
<OPTION value="none">--Select An Interval--
|
|
||||||
<OPTION value=<?php echo INT_DAILY?> <?php echo $interval==INT_DAILY?"SELECTED":""?>>Daily
|
|
||||||
<OPTION value=<?php echo INT_WEEKLY?> <?php echo $interval==INT_WEEKLY?"SELECTED":""?>>Weekly
|
|
||||||
<OPTION value=<?php echo INT_MONTHLY?> <?php echo $interval==INT_MONTHLY?"SELECTED":""?>>Monthly
|
|
||||||
<OPTION value=<?php echo INT_YEARLY?> <?php echo $interval==INT_YEARLY?"SELECTED":""?>>Yearly
|
|
||||||
<OPTION value=<?php echo 24*60*60?> <?php echo $interval==24*60*60?"SELECTED":""?>>24hrs
|
|
||||||
<OPTION value=<?php echo 30*24*60*60?> <?php echo $interval==30*24*60*60?"SELECTED":""?>>30days
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<td><SELECT name="limit">
|
|
||||||
<OPTION value="none">--How Many Results--
|
|
||||||
<OPTION value=20 <?php echo $limit==20?"SELECTED":""?>>20
|
|
||||||
<OPTION value=50 <?php echo $limit==50?"SELECTED":""?>>50
|
|
||||||
<OPTION value=100 <?php echo $limit==100?"SELECTED":""?>>100
|
|
||||||
<OPTION value=all <?php echo $limit=="all"?"SELECTED":""?>>All
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<td>Subnet Filter:<input name=subnet value="<?php echo isset($subnet)?$subnet:"0.0.0.0/0"?>">
|
|
||||||
<input type=submit value="Go">
|
|
||||||
</table>
|
|
||||||
</FORM>
|
|
||||||
<?php
|
|
||||||
// Set defaults
|
|
||||||
if (!isset($interval))
|
|
||||||
$interval = DFLT_INTERVAL;
|
|
||||||
|
|
||||||
if (!isset($timestamp))
|
|
||||||
$timestamp = time() - $interval + (0.05*$interval);
|
|
||||||
|
|
||||||
if (!isset($limit))
|
|
||||||
$limit = 20;
|
|
||||||
|
|
||||||
// Validation
|
|
||||||
if (!isset($sensor_name))
|
|
||||||
exit(0);
|
|
||||||
|
|
||||||
// Print Title
|
|
||||||
|
|
||||||
if (isset($limit))
|
|
||||||
echo "<h2>Top $limit - $sensor_name</h2>";
|
|
||||||
else
|
|
||||||
echo "<h2>All Records - $sensor_name</h2>";
|
|
||||||
|
|
||||||
// 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 "</center><pre>$sql</pre><center>"; 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 "<table width=100% border=1 cellspacing=0><tr><td>Ip<td>Name<td>Total<td>Sent<td>Received<td>tcp<td>udp<td>icmp<td>http<td>smtp<td>ftp";
|
|
||||||
|
|
||||||
if (!isset($subnet)) // Set this now for total graphs
|
|
||||||
$subnet = "0.0.0.0/0";
|
|
||||||
|
|
||||||
// Output Total Line
|
|
||||||
echo "<TR><TD><a href=Total>Total</a><TD>$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 "<tr><td><a href=#".$r['ip'].">";
|
|
||||||
echo $r['ip']."<td>".gethostbyaddr($r['ip']);
|
|
||||||
echo "</a>";
|
|
||||||
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 "</table></center>";
|
|
||||||
|
|
||||||
// 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 "<a name=Total><h3><a href=details.php?sensor_name=$sensor_name&ip=$subnet>";
|
|
||||||
echo "Total - Total of $subnet</h3>";
|
|
||||||
echo "</a>";
|
|
||||||
echo "Send:<br><img src=graph.php?ip=$subnet&interval=$interval&sensor_name=".$sensor_name."&table=$total_table><br>";
|
|
||||||
echo "<img src=legend.gif><br>\n";
|
|
||||||
if ($subnet == "0.0.0.0/0")
|
|
||||||
$total_table = "bd_rx_total_log";
|
|
||||||
else
|
|
||||||
$total_table = "bd_rx_log";
|
|
||||||
echo "Receive:<br><img src=graph.php?ip=$subnet&interval=$interval&sensor_name=".$sensor_name."&table=$total_table><br>";
|
|
||||||
echo "<img src=legend.gif><br>\n";
|
|
||||||
|
|
||||||
|
|
||||||
// Output Other Graphs
|
|
||||||
for($Counter=0; $Counter < pg_num_rows($result) && $Counter < $limit; $Counter++)
|
|
||||||
{
|
|
||||||
$r = pg_fetch_array($result, $Counter);
|
|
||||||
echo "<a name=".$r['ip']."><h3><a href=details.php?sensor_name=$sensor_name&ip=".$r['ip'].">";
|
|
||||||
if ($r['ip'] == "0.0.0.0")
|
|
||||||
echo "Total - Total of all subnets</h3>";
|
|
||||||
else
|
|
||||||
echo $r['ip']." - ".gethostbyaddr($r['ip'])."</h3>";
|
|
||||||
echo "</a>";
|
|
||||||
echo "Send:<br><img src=graph.php?ip=".$r['ip']."&interval=$interval&sensor_name=".$sensor_name."&table=bd_tx_log&yscale=".(max($r['txscale'], $r['rxscale']))."><br>";
|
|
||||||
echo "<img src=legend.gif><br>\n";
|
|
||||||
echo "Receive:<br><img src=graph.php?ip=".$r['ip']."&interval=$interval&sensor_name=".$sensor_name."&table=bd_rx_log&yscale=".(max($r['txscale'], $r['rxscale']))."><br>";
|
|
||||||
echo "<img src=legend.gif><br>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
include('footer.php');
|
|
|
@ -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]))
|
|
|
@ -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, "<TR bgcolor=lightblue><TD>Ip and Name<TD align=center>Total<TD align=center>Total Sent<TD align=center>Total Received<TD align=center>FTP<TD align=center>HTTP<TD align=center>P2P<TD align=center>TCP<TD align=center>UDP<TD align=center>ICMP\n");
|
|
||||||
+ fprintf(file, "<TR bgcolor=lightblue><TD>Ip and Name<TD align=center>Total<TD align=center>Total Sent<TD align=center>Total Received<TD align=center>FTP<TD align=center>HTTP<TD align=center>SMTP<TD align=center>TCP<TD align=center>UDP<TD align=center>ICMP\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, "<TR bgcolor=lightblue><TD>Ip and Name<TD align=center>Total<TD align=center>Total Sent<TD align=center>Total Received<TD align=center>FTP<TD align=center>HTTP<TD align=center>P2P<TD align=center>TCP<TD align=center>UDP<TD align=center>ICMP\n");
|
|
||||||
+ fprintf(file, "<TR bgcolor=lightblue><TD>Ip and Name<TD align=center>Total<TD align=center>Total Sent<TD align=center>Total Received<TD align=center>FTP<TD align=center>HTTP<TD align=center>SMTP<TD align=center>TCP<TD align=center>UDP<TD align=center>ICMP\n");
|
|
||||||
for (tCounter=0, Counter=0; Counter < NumIps; Counter++)
|
|
||||||
{
|
|
||||||
if (SubnetTable[SubnetCounter].ip == (SummaryData[Counter]->IP & SubnetTable[SubnetCounter].mask))
|
|
|
@ -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
|
|
|
@ -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;
|
|
|
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=collectd
|
PKG_NAME:=collectd
|
||||||
PKG_VERSION:=5.12.0
|
PKG_VERSION:=5.12.0
|
||||||
PKG_RELEASE:=48
|
PKG_RELEASE:=49
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||||
PKG_SOURCE_URL:=https://collectd.org/files/ \
|
PKG_SOURCE_URL:=https://collectd.org/files/ \
|
||||||
|
@ -463,7 +463,7 @@ $(eval $(call BuildPlugin,chrony,chrony status input,chrony,))
|
||||||
$(eval $(call BuildPlugin,conntrack,connection tracking table size input,conntrack,))
|
$(eval $(call BuildPlugin,conntrack,connection tracking table size input,conntrack,))
|
||||||
$(eval $(call BuildPlugin,contextswitch,context switch input,contextswitch,))
|
$(eval $(call BuildPlugin,contextswitch,context switch input,contextswitch,))
|
||||||
$(eval $(call BuildPlugin,cpu,CPU input,cpu,))
|
$(eval $(call BuildPlugin,cpu,CPU input,cpu,))
|
||||||
$(eval $(call BuildPlugin,cpufreq,CPU Freq input,cpufreq,@(TARGET_x86||TARGET_x86_64||TARGET_mvebu||TARGET_ipq806x||TARGET_armsr||TARGET_ipq40xx||TARGET_bcm27xx_bcm2709||TARGET_rockchip||TARGET_mediatek||TARGET_qualcommax))) # Only enable on targets with CPUs supporting frequency scaling
|
$(eval $(call BuildPlugin,cpufreq,CPU Freq input,cpufreq,))
|
||||||
$(eval $(call BuildPlugin,csv,CSV output,csv,))
|
$(eval $(call BuildPlugin,csv,CSV output,csv,))
|
||||||
$(eval $(call BuildPlugin,curl,cURL input,curl,+PACKAGE_collectd-mod-curl:libcurl))
|
$(eval $(call BuildPlugin,curl,cURL input,curl,+PACKAGE_collectd-mod-curl:libcurl))
|
||||||
#$(eval $(call BuildPlugin,dbi,relational database input,dbi,+PACKAGE_collectd-mod-dbi:libdbi))
|
#$(eval $(call BuildPlugin,dbi,relational database input,dbi,+PACKAGE_collectd-mod-dbi:libdbi))
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=conmon
|
PKG_NAME:=conmon
|
||||||
PKG_VERSION:=2.1.7
|
PKG_VERSION:=2.1.8
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=https://github.com/containers/$(PKG_NAME)/archive/v$(PKG_VERSION)
|
PKG_SOURCE_URL:=https://github.com/containers/$(PKG_NAME)/archive/v$(PKG_VERSION)
|
||||||
PKG_HASH:=7d0f9a2f7cb8a76c51990128ac837aaf0cc89950b6ef9972e94417aa9cf901fe
|
PKG_HASH:=e72c090210a03ca3b43a0fad53f15bca90bbee65105c412468009cf3a5988325
|
||||||
|
|
||||||
PKG_MAINTAINER:=Oskari Rauta <oskari.rauta@gmail.com>
|
PKG_MAINTAINER:=Oskari Rauta <oskari.rauta@gmail.com>
|
||||||
PKG_LICENSE:=Apache-2.0
|
PKG_LICENSE:=Apache-2.0
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=crun
|
PKG_NAME:=crun
|
||||||
PKG_VERSION:=1.8.5
|
PKG_VERSION:=1.9
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=https://codeload.github.com/containers/crun/tar.gz/$(PKG_VERSION)?
|
PKG_SOURCE_URL:=https://codeload.github.com/containers/crun/tar.gz/$(PKG_VERSION)?
|
||||||
PKG_HASH:=14e3d4b35767e02f2da97342e703a284738f2f0f86b4dbfb467f2b8b294ef391
|
PKG_HASH:=dfe15045953f6876fde273518ac2cafbabda7c0eebd3dcdba34c4e5dc8b46661
|
||||||
|
|
||||||
PKG_BUILD_DEPENDS:=argp-standalone
|
PKG_BUILD_DEPENDS:=argp-standalone
|
||||||
PKG_BUILD_PARALLEL:=1
|
PKG_BUILD_PARALLEL:=1
|
||||||
|
@ -31,13 +31,13 @@ define Package/crun/description
|
||||||
A fast and low-memory footprint OCI Container Runtime fully written in C.
|
A fast and low-memory footprint OCI Container Runtime fully written in C.
|
||||||
endef
|
endef
|
||||||
|
|
||||||
LIBOCISPEC_COMMIT:=19c05670c37a42c217caa7b141bcaada7867cc15
|
LIBOCISPEC_COMMIT:=3d168261f250477061fe0eb3648bf998c70c6519
|
||||||
|
|
||||||
define Download/libocispec
|
define Download/libocispec
|
||||||
PROTO:=git
|
PROTO:=git
|
||||||
URL:=https://github.com/containers/libocispec.git
|
URL:=https://github.com/containers/libocispec.git
|
||||||
VERSION:=$(LIBOCISPEC_COMMIT)
|
VERSION:=$(LIBOCISPEC_COMMIT)
|
||||||
MIRROR_HASH:=eacd0096e4acdcdb7f5062897e336934844b45d3b1d8a306801eb39ea9fae5c0
|
MIRROR_HASH:=4e308ff6a40e38aee184abef9156fa92b1ea9f978e277be2ed7b12f9e06f717f
|
||||||
FILE:=libocispec-$(LIBOCISPEC_COMMIT).tar.xz
|
FILE:=libocispec-$(LIBOCISPEC_COMMIT).tar.xz
|
||||||
SUBDIR:=libocispec
|
SUBDIR:=libocispec
|
||||||
endef
|
endef
|
||||||
|
@ -53,7 +53,7 @@ CONFIGURE_ARGS+= \
|
||||||
|
|
||||||
define Build/Prepare
|
define Build/Prepare
|
||||||
$(call Build/Prepare/Default)
|
$(call Build/Prepare/Default)
|
||||||
$(SED) '/#include <git-version.h>/d' $(PKG_BUILD_DIR)/src/crun.c
|
$(SED) '/#include <git-version.h>/d' $(PKG_BUILD_DIR)/src/{crun.c,libcrun/container.c}
|
||||||
xzcat $(DL_DIR)/libocispec-$(LIBOCISPEC_COMMIT).tar.xz | $(HOST_TAR) -C $(PKG_BUILD_DIR) $(TAR_OPTIONS)
|
xzcat $(DL_DIR)/libocispec-$(LIBOCISPEC_COMMIT).tar.xz | $(HOST_TAR) -C $(PKG_BUILD_DIR) $(TAR_OPTIONS)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=dockerd
|
PKG_NAME:=dockerd
|
||||||
PKG_VERSION:=24.0.5
|
PKG_VERSION:=24.0.5
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=2
|
||||||
PKG_LICENSE:=Apache-2.0
|
PKG_LICENSE:=Apache-2.0
|
||||||
PKG_LICENSE_FILES:=LICENSE
|
PKG_LICENSE_FILES:=LICENSE
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ if [ -z "${GIT_DIR}" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
clean_up() {
|
clean_up() {
|
||||||
rm --force --recursive "${GIT_DIR}"
|
rm -rf "${GIT_DIR}"
|
||||||
}
|
}
|
||||||
trap clean_up EXIT
|
trap clean_up EXIT
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=podman
|
PKG_NAME:=podman
|
||||||
PKG_VERSION:=4.5.1
|
PKG_VERSION:=4.6.2
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=2
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=https://github.com/containers/podman/archive/v$(PKG_VERSION)
|
PKG_SOURCE_URL:=https://github.com/containers/podman/archive/v$(PKG_VERSION)
|
||||||
PKG_HASH:=ee2c8b02b7fe301057f0382637b995a9c6c74e8d530692d6918e4c509ade6e39
|
PKG_HASH:=2d8e04f0c3819c3f0ed1ca5d01da87e6d911571b96ae690448f7f75df41f2ad1
|
||||||
|
|
||||||
PKG_LICENSE:=Apache-2.0
|
PKG_LICENSE:=Apache-2.0
|
||||||
PKG_LICENSE_FILES:=LICENSE
|
PKG_LICENSE_FILES:=LICENSE
|
||||||
|
@ -39,7 +39,7 @@ define Package/podman
|
||||||
CATEGORY:=Utilities
|
CATEGORY:=Utilities
|
||||||
TITLE:=Podman
|
TITLE:=Podman
|
||||||
URL:=https://podman.io
|
URL:=https://podman.io
|
||||||
DEPENDS:=$(GO_ARCH_DEPENDS) +conmon +libgpgme +libseccomp +nsenter +zoneinfo-simple +kmod-veth +slirp4netns +netavark +aardvark-dns +PODMAN_SELINUX_SUPPORT:libselinux
|
DEPENDS:=$(GO_ARCH_DEPENDS) +conmon +libgpgme +libseccomp +nsenter +zoneinfo-simple +kmod-veth +slirp4netns +netavark +aardvark-dns +catatonit +PODMAN_SELINUX_SUPPORT:libselinux
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/podman/description
|
define Package/podman/description
|
||||||
|
@ -115,6 +115,7 @@ define Package/podman/install
|
||||||
$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/podman
|
$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/podman
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{podman,podman-remote} $(1)/usr/bin/
|
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{podman,podman-remote} $(1)/usr/bin/
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/podman/{rootlessport,quadlet} $(1)/usr/lib/podman/
|
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/podman/{rootlessport,quadlet} $(1)/usr/lib/podman/
|
||||||
|
$(LN) podman $(1)/usr/bin/podmansh
|
||||||
$(INSTALL_DIR) $(1)/etc/containers
|
$(INSTALL_DIR) $(1)/etc/containers
|
||||||
$(INSTALL_DATA) $(DL_DIR)/default-policy.json-362f70b056 $(1)/etc/containers/policy.json
|
$(INSTALL_DATA) $(DL_DIR)/default-policy.json-362f70b056 $(1)/etc/containers/policy.json
|
||||||
$(INSTALL_DATA) $(DL_DIR)/registries.fedora-da9a9c8778 $(1)/etc/containers/registries.conf
|
$(INSTALL_DATA) $(DL_DIR)/registries.fedora-da9a9c8778 $(1)/etc/containers/registries.conf
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
--- a/Makefile
|
--- a/Makefile
|
||||||
+++ b/Makefile
|
+++ b/Makefile
|
||||||
@@ -209,7 +209,7 @@ GV_SHA=aab0ac9367fc5142f5857c36ac2352bcb
|
@@ -211,7 +211,7 @@ GV_SHA=407efb5dcdb0f4445935f7360535800b6
|
||||||
default: all
|
default: all
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
.PHONY: binaries
|
.PHONY: binaries
|
||||||
ifeq ($(shell uname -s),FreeBSD)
|
ifeq ($(shell uname -s),FreeBSD)
|
||||||
@@ -790,7 +790,7 @@ package-install: package ## Install rpm
|
@@ -798,7 +798,7 @@ rpm-install: package ## Install rpm pac
|
||||||
/usr/bin/podman info # will catch a broken conmon
|
/usr/bin/podman info # will catch a broken conmon
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
|
|
Loading…
Reference in a new issue