FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
+1 vote
586 views 2 comments
by anonymous

Hi guys!
I made monitoring system based on Raspberry Pi, now I added several RUT230/240/955 and I want keep same system.
On Raspberry Pi I used vnstat, correctly working but I can't make it working on Teltonika devices.
FW ver.: RUT9XX_R_00.06.07.4

Here my vnstat configuration file

# vnStat 1.12 config file

# default interface
Interface "wwan0"
# location of the database directory
DatabaseDir "/var/lib/vnstat"
# locale (LC_ALL) ("-" = use system locale)
Locale "-"
# on which day should months change
MonthRotate 1

# date output formats for -d, -m, -t and -w
# see 'man date' for control codes
DayFormat    "%x"
MonthFormat  "%b '%y"
TopFormat    "%x"

# 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/TiB)
# 1 = old style binary prefixes (KB/MB/GB/TB)
UnitMode 0

# output style
# 0 = minimal & narrow, 1 = bar column visible
# 2 = same as 1 except rate in summary and weekly
# 3 = rate column visible
OutputStyle 3

# used rate unit (0 = bytes, 1 = bits)
RateUnit 1

# maximum bandwidth (Mbit) for all interfaces, 0 = disable feature
# (unless interface specific limit is given)
MaxBandwidth 100

# interface specific limits
#  example 8Mbit limit for 'ethnone':
MaxBWethnone 8

# how many seconds should sampling for -tr take by default
Sampletime 5

# default query mode
# 0 = normal, 1 = days, 2 = months, 3 = top10
# 4 = exportdb, 5 = short, 6 = weeks, 7 = hours
QueryMode 0

# filesystem disk space check (1 = enabled, 0 = disabled)
CheckDiskSpace 1

# database file locking (1 = enabled, 0 = disabled)
UseFileLocking 1

# how much the boot time can variate between updates (seconds)
BootVariation 15

# log days without traffic to daily list (1 = enabled, 0 = disabled)
TrafficlessDays 1


# vnstatd
##

# switch to given user when started as root (leave empty to disable)
DaemonUser ""

# switch to given user when started as root (leave empty to disable)
DaemonGroup ""

# how often (in seconds) interface data is updated
UpdateInterval 60

# how often (in seconds) interface status changes are checked
PollInterval 30

# how often (in minutes) data is saved to file
SaveInterval 30

# how often (in minutes) data is saved when all interface are offline
OfflineSaveInterval 30

# 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"


# vnstati
##

# title timestamp format
HeaderFormat "%x %H:%M"

# show hours with rate (1 = enabled, 0 = disabled)
HourlyRate 1

# show rate in summary (1 = enabled, 0 = disabled)
SummaryRate 1

# layout of summary (1 = with monthly, 0 = without monthly)
SummaryLayout 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            "-"

I can't get values updated.
On several forums it was said to change owner/permissions to vnstat user/group but I'm already running vnstat as root.
I solved restarting vnstat every 5 minutes through crontab

root@Teltonika-RUT955I:~# crontab -l
*/5 * * * * /etc/init.d/vnstat restart

But it doesn't look smart solution.
Any ideas?
Thanks.

2 Answers

0 votes
by anonymous

Solved!

On vnstat configuration (file /etc/vnstat.conf) default database directory is:

DatabaseDir "/var/lib/vnstat"

but /var is linked under /tmp, so all data is lost after reboot.
I changed dir to:

DatabaseDir "/etc/vnstat"

and now I can see traffic ov previous days.

Best answer
0 votes
by anonymous

Hi,

Could you check what command df outputs you in the console when vnstat stops working? It could be that it's not enough of memory to store that data.

Have you checked if vnstat service is still working after the package becomes unresponsive?

In any case - it's a third-party opkg package and there's not much we can do about it as it's not one of the main features in our routers.

EB.

by anonymous
root@Teltonika-LM07:~# ps | grep vnstat
 4330 root       984 S    /usr/sbin/vnstatd -d
 4435 root      1516 S    grep vnstat

root@Teltonika-LM07:~# df -h
Filesystem                Size      Used Available Use% Mounted on
rootfs                    2.4M    864.0K      1.5M  36% /
/dev/root                11.8M     11.8M         0 100% /rom
tmpfs                    29.8M    924.0K     28.9M   3% /tmp
/dev/mtdblock5            2.4M    864.0K      1.5M  36% /overlay
overlayfs:/overlay        2.4M    864.0K      1.5M  36% /
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/mtdblock7          576.0K    256.0K    320.0K  44% /mnt/mtdblock7
by anonymous
Thank you so so much. This answer was very very useful to me.