mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Remove vnstat
This commit is contained in:
parent
22d85573be
commit
9b827bf413
6 changed files with 0 additions and 434 deletions
115
vnstat/Makefile
115
vnstat/Makefile
|
@ -1,115 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2006-2014 OpenWrt.org
|
||||
# Copyright (C) 2019-2020 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=vnstat
|
||||
PKG_VERSION:=2.6
|
||||
PKG_RELEASE:=3
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://humdi.net/vnstat
|
||||
PKG_HASH:=89276e0a7281943edb554b874078278ad947dc312938a2451e03eb80679f7ff7
|
||||
PKG_MAINTAINER:=Ycarus <ycarus@zugaina.org>
|
||||
|
||||
PKG_INSTALL:=1
|
||||
|
||||
PKG_BUILD_DEPENDS:=libgd
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/vnstat/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
URL:=http://humdi.net/vnstat/
|
||||
DEPENDS:=+libsqlite3
|
||||
endef
|
||||
|
||||
define Package/vnstat
|
||||
$(call Package/vnstat/Default)
|
||||
TITLE:=Console-based network traffic monitor
|
||||
endef
|
||||
|
||||
define Package/vnstat/description
|
||||
vnStat is a network traffic monitor for Linux that keeps a log of daily
|
||||
network traffic for the selected interface(s). vnStat isn't a packet
|
||||
sniffer. The traffic information is analyzed from the /proc -filesystem,
|
||||
so vnStat can be used without root permissions.
|
||||
endef
|
||||
|
||||
define Package/vnstati
|
||||
$(call Package/vnstat/Default)
|
||||
DEPENDS+=vnstat +libgd
|
||||
TITLE:=PNG image output support for vnStat
|
||||
endef
|
||||
|
||||
define Package/vnstati/description
|
||||
The purpose of vnstati is to provide image output support for statistics
|
||||
collected using vnstat(1). However, the image file format is limited to
|
||||
png. All basic outputs of vnStat are supported excluding live traffic
|
||||
features. The image can be outputted either to a file or to standard
|
||||
output.
|
||||
endef
|
||||
|
||||
define Package/vnstat/conffiles
|
||||
/etc/vnstat.conf
|
||||
/etc/config/vnstat
|
||||
/var/lib/vnstat.db
|
||||
endef
|
||||
|
||||
define Build/Compile/vnstat
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
|
||||
$(TARGET_CONFIGURE_OPTS) \
|
||||
CFLAGS="$(TARGET_CFLAGS)" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS)"
|
||||
endef
|
||||
|
||||
define Build/Compile/vnstati
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
|
||||
$(TARGET_CONFIGURE_OPTS) \
|
||||
CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS) -Wl,-rpath-link,$(STAGING_DIR)/usr/lib" \
|
||||
all
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(call Build/Compile/vnstat)
|
||||
$(call Build/Compile/vnstati)
|
||||
endef
|
||||
|
||||
define Package/vnstat/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/vnstat $(1)/usr/bin/
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/sbin/vnstatd $(1)/usr/sbin/
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(INSTALL_CONF) ./files/vnstat.conf $(1)/etc/
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) ./files/vnstat.config $(1)/etc/config/vnstat
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/vnstat.init $(1)/etc/init.d/vnstat
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/vnstat.defaults $(1)/etc/uci-defaults/vnstat
|
||||
$(INSTALL_DIR) $(1)/usr/libexec/rpcd
|
||||
$(INSTALL_BIN) ./files/vnstat.rpcd $(1)/usr/libexec/rpcd/vnstat
|
||||
endef
|
||||
|
||||
define Package/vnstati/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/bin/vnstati $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
define Package/vnstat/postinst
|
||||
#!/bin/sh
|
||||
[ -n "$${IPKG_INSTROOT}" ] || (. /etc/uci-defaults/vnstat) && rm -f /etc/uci-defaults/vnstat
|
||||
exit 0
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,vnstat))
|
||||
$(eval $(call BuildPackage,vnstati))
|
|
@ -1,186 +0,0 @@
|
|||
# vnStat 2.4 config file
|
||||
##
|
||||
|
||||
# default interface (leave empty for automatic selection)
|
||||
Interface ""
|
||||
|
||||
# location of the database directory
|
||||
DatabaseDir "/var/lib/vnstat"
|
||||
|
||||
# locale (LC_ALL) ("-" = use system locale)
|
||||
Locale "-"
|
||||
|
||||
# date output formats for -d, -m, -t and -w
|
||||
DayFormat "%Y-%m-%d"
|
||||
MonthFormat "%Y-%m"
|
||||
TopFormat "%Y-%m-%d"
|
||||
|
||||
# characters used for visuals
|
||||
RXCharacter "%"
|
||||
TXCharacter ":"
|
||||
RXHourCharacter "r"
|
||||
TXHourCharacter "t"
|
||||
|
||||
# how units are prefixed when traffic is shown
|
||||
# 0 = IEC standard prefixes (KiB/MiB/GiB...)
|
||||
# 1 = old style binary prefixes (KB/MB/GB...)
|
||||
# 2 = SI decimal prefixes (kB/MB/GB...)
|
||||
UnitMode 0
|
||||
|
||||
# used rate unit (0 = bytes, 1 = bits)
|
||||
RateUnit 1
|
||||
|
||||
# how units are prefixed when traffic rate is shown in bits
|
||||
# 0 = IEC binary prefixes (Kibit/s...)
|
||||
# 1 = SI decimal prefixes (kbit/s...)
|
||||
RateUnitMode 1
|
||||
|
||||
# output style
|
||||
# 0 = minimal & narrow, 1 = bar column visible
|
||||
# 2 = same as 1 except rate in summary
|
||||
# 3 = rate column visible
|
||||
OutputStyle 3
|
||||
|
||||
# number of decimals to use in outputs
|
||||
DefaultDecimals 2
|
||||
HourlyDecimals 1
|
||||
|
||||
# spacer for separating hourly sections (0 = none, 1 = '|', 2 = '][', 3 = '[ ]')
|
||||
HourlySectionStyle 2
|
||||
|
||||
# how many seconds should sampling for -tr take by default
|
||||
Sampletime 5
|
||||
|
||||
# default query mode
|
||||
# 0 = normal, 1 = days, 2 = months, 3 = top, 5 = short
|
||||
# 7 = hours, 8 = xml, 9 = one line, 10 = json
|
||||
QueryMode 0
|
||||
|
||||
# default list output entry count (0 = all)
|
||||
List5Mins 24
|
||||
ListHours 24
|
||||
ListDays 30
|
||||
ListMonths 12
|
||||
ListYears 0
|
||||
ListTop 10
|
||||
|
||||
|
||||
# vnstatd
|
||||
##
|
||||
|
||||
# switch to given user when started as root (leave empty to disable)
|
||||
DaemonUser ""
|
||||
|
||||
# switch to given group when started as root (leave empty to disable)
|
||||
DaemonGroup ""
|
||||
|
||||
# try to detect interface maximum bandwidth, 0 = disable feature
|
||||
# MaxBandwidth will be used as fallback value when enabled
|
||||
BandwidthDetection 1
|
||||
|
||||
# maximum bandwidth (Mbit) for all interfaces, 0 = disable feature
|
||||
# (unless interface specific limit is given)
|
||||
MaxBandwidth 1000
|
||||
|
||||
# interface specific limits
|
||||
# example 8Mbit limit for 'ethnone':
|
||||
MaxBWethnone 8
|
||||
|
||||
# data retention durations (-1 = unlimited, 0 = feature disabled)
|
||||
5MinuteHours 48
|
||||
HourlyDays 4
|
||||
DailyDays 62
|
||||
MonthlyMonths 25
|
||||
YearlyYears -1
|
||||
TopDayEntries 20
|
||||
|
||||
# how often (in seconds) interface data is updated
|
||||
UpdateInterval 20
|
||||
|
||||
# how often (in seconds) interface status changes are checked
|
||||
PollInterval 5
|
||||
|
||||
# how often (in minutes) data is saved to database
|
||||
SaveInterval 5
|
||||
|
||||
# how often (in minutes) data is saved when all interface are offline
|
||||
OfflineSaveInterval 30
|
||||
|
||||
# on which day should months change
|
||||
MonthRotate 1
|
||||
MonthRotateAffectsYears 0
|
||||
|
||||
# filesystem disk space check (1 = enabled, 0 = disabled)
|
||||
CheckDiskSpace 1
|
||||
|
||||
# how much the boot time can variate between updates (seconds)
|
||||
BootVariation 15
|
||||
|
||||
# create database entries even when there is no traffic (1 = enabled, 0 = disabled)
|
||||
TrafficlessEntries 1
|
||||
|
||||
# how many minutes to wait during daemon startup for system clock to
|
||||
# sync time if most recent database update appears to be in the future
|
||||
TimeSyncWait 5
|
||||
|
||||
# how often (in minutes) bandwidth detection is done when
|
||||
# BandwidthDetection is enabled (0 = disabled)
|
||||
BandwidthDetectionInterval 5
|
||||
|
||||
# force data save when interface status changes (1 = enabled, 0 = disabled)
|
||||
SaveOnStatusChange 1
|
||||
|
||||
# enable / disable logging (0 = disabled, 1 = logfile, 2 = syslog)
|
||||
UseLogging 2
|
||||
|
||||
# create dirs if needed (1 = enabled, 0 = disabled)
|
||||
CreateDirs 1
|
||||
|
||||
# update ownership of files if needed (1 = enabled, 0 = disabled)
|
||||
UpdateFileOwner 1
|
||||
|
||||
# file used for logging if UseLogging is set to 1
|
||||
LogFile "/var/log/vnstat/vnstat.log"
|
||||
|
||||
# file used as daemon pid / lock file
|
||||
PidFile "/var/run/vnstat/vnstat.pid"
|
||||
|
||||
# 1 = 64-bit, 0 = 32-bit, -1 = old style logic, -2 = automatic detection
|
||||
64bitInterfaceCounters -2
|
||||
|
||||
# use SQLite Write-Ahead Logging mode (1 = enabled, 0 = disabled)
|
||||
DatabaseWriteAheadLogging 0
|
||||
|
||||
# change the setting of the SQLite "synchronous" flag
|
||||
# (-1 = auto, 0 = off, 1, = normal, 2 = full, 3 = extra)
|
||||
DatabaseSynchronous -1
|
||||
|
||||
|
||||
# vnstati
|
||||
##
|
||||
|
||||
# title timestamp format
|
||||
HeaderFormat "%Y-%m-%d %H:%M"
|
||||
|
||||
# show hours with rate (1 = enabled, 0 = disabled)
|
||||
HourlyRate 1
|
||||
|
||||
# show rate in summary (1 = enabled, 0 = disabled)
|
||||
SummaryRate 1
|
||||
|
||||
# transparent background (1 = enabled, 0 = disabled)
|
||||
TransparentBg 0
|
||||
|
||||
# image colors
|
||||
CBackground "FFFFFF"
|
||||
CEdge "AEAEAE"
|
||||
CHeader "606060"
|
||||
CHeaderTitle "FFFFFF"
|
||||
CHeaderDate "FFFFFF"
|
||||
CText "000000"
|
||||
CLine "B0B0B0"
|
||||
CLineL "-"
|
||||
CRx "92CF00"
|
||||
CTx "606060"
|
||||
CRxD "-"
|
||||
CTxD "-"
|
|
@ -1,5 +0,0 @@
|
|||
config vnstat
|
||||
list interface br-lan
|
||||
# list interface eth0.1
|
||||
# option remote http://example.org/vnstat/
|
||||
# option symlink /www/vnstat
|
|
@ -1,20 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
wan="$(uci -P/var/state get network.wan.ifname)"
|
||||
|
||||
if [ -n "$wan" ]; then
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
del_list vnstat.@vnstat[-1].interface=$wan
|
||||
add_list vnstat.@vnstat[-1].interface=$wan
|
||||
commit vnstat
|
||||
EOF
|
||||
fi
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@vnstat[-1]
|
||||
add ucitrack vnstat
|
||||
set ucitrack.@vnstat[-1].init=vnstat
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
exit 0
|
|
@ -1,53 +0,0 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2008-2011 OpenWrt.org
|
||||
|
||||
START=99
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
vnstat_option() {
|
||||
sed -ne "s/^[[:space:]]*$1[[:space:]]*['\"]\([^'\"]*\)['\"].*/\1/p" \
|
||||
/etc/vnstat.conf
|
||||
}
|
||||
|
||||
start_service() {
|
||||
local lib="$(vnstat_option DatabaseDir)"
|
||||
|
||||
[ -n "$lib" ] || {
|
||||
echo "Error: No DatabaseDir set in vnstat.conf" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
init_ifaces() {
|
||||
local cfg="$1"
|
||||
local url lnk
|
||||
|
||||
init_iface() {
|
||||
local ifn="$1"
|
||||
/usr/bin/vnstat --add -i "$ifn" >/dev/null
|
||||
}
|
||||
|
||||
config_list_foreach "$cfg" interface init_iface
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
config_load vnstat
|
||||
config_foreach init_ifaces vnstat
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_set_param command /usr/sbin/vnstatd --nodaemon
|
||||
procd_set_param file /etc/vnstat.conf
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
procd_send_signal vnstat
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger vnstat
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
#!/bin/sh
|
||||
# Copyright (C) 2019 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
|
||||
|
||||
case "$1" in
|
||||
list)
|
||||
echo '{ "speed": { "ifname": "eth0" }, "speedallif": {},"hours": { "ifname": "eth0" },"days": { "ifname": "eth0" },"months": { "ifname": "eth0" },"weeks": { "ifname": "eth0" },"top10": { "ifname": "eth0" } }'
|
||||
;;
|
||||
call)
|
||||
case "$2" in
|
||||
speed)
|
||||
read input;
|
||||
IFNAME=`echo $input | jsonfilter -e '@.ifname'`
|
||||
vnstat -i $IFNAME --json -tr
|
||||
;;
|
||||
speedallif)
|
||||
echo '{'
|
||||
for IFPATH in $(multipath | awk '/default/ {print $1}')
|
||||
do
|
||||
IFNAME=$(basename -- "$IFPATH")
|
||||
[ -n "$IFNAME" ] && {
|
||||
echo '"'$IFNAME'": '
|
||||
vnstat -i $IFNAME --json -tr
|
||||
echo ','
|
||||
}
|
||||
done
|
||||
echo '}'
|
||||
;;
|
||||
hours)
|
||||
read input;
|
||||
IFNAME=`echo $input | jsonfilter -e '@.ifname'`
|
||||
vnstat -i $IFNAME -h --json
|
||||
;;
|
||||
days)
|
||||
read input;
|
||||
IFNAME=`echo $input | jsonfilter -e '@.ifname'`
|
||||
vnstat -i $IFNAME -d --json
|
||||
;;
|
||||
months)
|
||||
read input;
|
||||
IFNAME=`echo $input | jsonfilter -e '@.ifname'`
|
||||
vnstat -i $IFNAME -m --json
|
||||
;;
|
||||
weeks)
|
||||
read input;
|
||||
IFNAME=`echo $input | jsonfilter -e '@.ifname'`
|
||||
vnstat -i $IFNAME -w --json
|
||||
;;
|
||||
top10)
|
||||
read input;
|
||||
IFNAME=`echo $input | jsonfilter -e '@.ifname'`
|
||||
vnstat -i $IFNAME -t --json
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
Loading…
Add table
Add a link
Reference in a new issue