VNSTATI(1)

πŸ’… vnstati(1) β€” image output support for vnStat ✨

okay bestie, this is the vnstati(1) page from User Manuals, and it’s literally the glow-up era for your traffic stats πŸŽ€

🌸 NAME 🌸

vnstati β€” image output support for vnStat

✨ SYNOPSIS ✨

vnstati [-5bcdDehiLmosStvy?]  [--95th mode] [-5g [limit] [height]]
[--altdate] [--begin date] [--cache time] [--common-width] [--config
file] [--days [limit]] [--db file] [--dbdir directory] [--dbiflist
[mode]] [--debug] [--end date] [--fivegraph [limit] [height]]
[--fiveminutes [limit]] [--font file[:size]|size] [--headertext text]
[--help] [-hg [mode]] [--hours [limit]] [--hoursgraph [mode]] [-hs
[graph]] [--hsummary [graph]] [-i interface] [--iface interface] [-ic
[mode]] [--invert-colors [mode]] [--large] [--limit limit] [--locale
locale] [--months [limit]] [-ne] [-nh] [-nl] [--noedge] [--noheader]
[--nolegend] [--output file] [-ru [mode]] [--rateunit [mode]] [--scale
percent] [--small] [--style number] [--summary] [--top [limit]]
[--transparent [enabled]] [--version] [-vs [graph]] [--vsummary [graph]]
[interface]

πŸ¦‹ DESCRIPTION πŸ¦‹

The whole point of vnstati is to give you image output support for the statistics collected using vnstat(1). πŸ“Š The available image file formats depend on what’s supported by the used GD library. All basic outputs of vnStat are supported, excluding live traffic features. The image can be outputted either to a file or to standard output, with the latter being limited to png image format.


πŸŽ€ OPTIONS πŸŽ€

  • --95th mode β€” shows the 95th percentile output graph for the ongoing month. This output uses the 5 minute resolution data of the ongoing month to calculate the 95th percentile traffic rate for received, transmitted, or total as selected using the mandatory mode parameter. The 95th percentile will be shown as a horizontal line in the graph, with the exact 95th percentile traffic rate visible in the legend section of the image. In addition, a one hour resolution traffic rate bar graph averaged from the 5 minute resolution data of the selected mode is presented. This output requires the 5MinuteHours configuration option to have a value of at least 744 for storing all the necessary data, otherwise 100% coverage isn’t possible. Available modes: 0 = received, 1 = transmitted, 2 = total. πŸ’–
  • --altdate β€” uses an alternative date and time text location. The date and time text gets moved from the upper right header section to the lower left corner. This option has no effect if -nh, --noheader has been selected.
  • -b, --begin date β€” begins the list output with a specific date / time defined by date instead of the begin being selected based on the number of entries to be shown. If date isn’t available in the database, then the closest later date will be used. date supports the following formats: YYYY-MM-DD HH:MM, YYYY-MM-DD, and "today". This option can only be used with list outputs.
  • -c, --cache time β€” updates the output file only if at least time minutes have passed since the previous file update. This option is ignored if stdout is used as output.
  • --common-width β€” uses a common image width for summary (-s), list (-d/-m/-t/-y), hourly graph (-hg), and 5 minute graph (-5g) outputs based on the active font metrics. Narrower outputs are padded; list bars may grow or shrink slightly and the 5 minute graph sample count is chosen to match. When enabled, the optional limit given to -5g is ignored for width calculation. Can also be enabled with CommonWidth in the configuration file. Useful when vertical alignment of multiple images is needed. 🫢
  • --config file β€” uses file as configuration file instead of using automatic configuration file search functionality. If --config is used multiple times, the configuration settings from files later on the command line will override configuration settings loaded from earlier files if the settings defined in the files overlap.
  • -d, --days [limit] β€” outputs traffic statistics on a daily basis for the last days. The length of the list will be limited to 30 entries unless configured otherwise or unless the optional limit parameter is used. All entries stored in the database will be shown if limit is set to 0.
  • --db file β€” uses file as database file instead of searching for a database from the directory specified in the configuration file or the hardcoded default if no configuration file is available. This option overrides --dbdir.
  • --dbdir directory β€” uses directory as database directory instead of using the directory specified in the configuration file or the hardcoded default if no configuration file is available. This option is ignored if --db is also defined.
  • --dbiflist [mode] β€” lists interfaces currently in the database. If mode is not defined or is set to 0, then the output will use a one line verbose format. If mode is set to 1, then the output will contain one interface per line, and if mode is set to 2, then only the interface count will be shown as a single number. See also --iflist.
  • -D, --debug β€” shows additional debug output. Can be used multiple times for increased verbosity up to a maximum of 2.
  • -e, --end date β€” ends the list output with a specific date / time defined by date instead of the latest date / time in the database. If date isn’t available in the database, then the closest earlier date will be used. date supports the following formats: YYYY-MM-DD HH:MM and YYYY-MM-DD. This option can only be used with list outputs. The top list also requires --begin to be used at the same time with this option.
  • -5g, --fivegraph [limit] [height] β€” outputs traffic statistics with a 5 minute resolution for the last 48 hours using a bar graph. The width of the graph can be modified using the optional limit parameter, which represents the number of 5 minute entries with 12 entries for each hour. The smallest supported value is 288 (last 24 hours). Additionally, the height of the graph can be modified using the optional height parameter. The smallest supported height is 150 pixels. πŸ“ˆ
  • -5, --fiveminutes [limit] β€” outputs traffic statistics with a 5 minute resolution for the last hours. The length of the list will be limited to 24 entries unless configured otherwise or unless the optional limit parameter is used. All entries stored in the database will be shown if limit is set to 0.
  • --font file[:size]|size β€” uses a TrueType font file for image text, optionally setting point size. A bare size value (digits only) overrides the configured FontSize while keeping FontFile. libGD must provide FreeType support and the font file must be readable. πŸ”€
  • --headertext text β€” shows text in the image header section instead of automatically generated interface identification. text is limited to 64 characters and may not get completely shown if longer than the width of the image. Use with --altdate if maximal space is needed. This option has no effect if -nh, --noheader has been selected.
  • -h, --hours [limit] β€” outputs traffic statistics on a hourly basis. The length of the list will be limited to 24 entries unless configured otherwise or unless the optional limit parameter is used. All entries stored in the database will be shown if the limit is set to 0.
  • -hg, --hoursgraph [mode] β€” outputs traffic statistics on a hourly basis for the last 24 hours using a bar graph. The optional mode parameter can be used to override the configuration file setting. Available modes: 0 = 24 hour sliding window, 1 = graph begins from midnight. πŸŒ™
  • -hs, --hsummary [graph] β€” outputs traffic summary with the graph selected using the SummaryGraph setting in the configuration file next to it using a horizontal layout. The optional graph parameter can be used to override the configuration file setting. Available graphs: 0 = hours, 1 = 5 minutes.
  • -i, --iface interface β€” uses interface instead of default or configured interface. It is also possible to merge the information of two or more interfaces using the interface1+interface2+... syntax. All provided interfaces must be unique and must exist in the database when the merge syntax is used. Optionally, depending on the InterfaceMatchMethod configuration setting, interface can be replaced with alias previously set using vnstat --setalias. Merge syntax isn’t supported when alias is used. The -i, --iface option is optional and interface can be used as parameter on the command line for selecting the used interface even without the option being explicitly used. πŸ‘‘
  • -ic, --invert-colors [mode] β€” inverts image colors. Results in black becoming white, dark colors becoming light, light colors becoming dark, and white becoming black. The optional mode parameter can be used to change the color inversion behaviour. Available modes: 0 = no color inversion, 1 = invert all colors except those used for rx and tx, 2 = invert all colors. When mode isn’t specific, mode 1 will be used.
  • -L, --large β€” uses large fonts in output. When a TrueType font is selected with --font or FontFile, this multiplies the font size by 1.5.
  • --limit limit β€” sets the maximum number of shown entries in list outputs to limit. Usage of --limit overrides the default list entry limit values and the optional limit parameter given directly for a list query. All entries stored in the database will be shown if limit is set to 0.
  • --locale locale β€” uses locale instead of using the locale setting specified in the configuration file or the system default if no configuration file is available.
  • -m, --months [limit] β€” outputs traffic statistics on a monthly basis for the last months. The length of the list will be limited to 12 entries unless configured otherwise or unless the optional limit parameter is used. All entries stored in the database will be shown if limit is set to 0.
  • -ne, --noedge β€” removes darker edges from around the image.
  • -nh, --noheader β€” removes header containing title and update time. Time of the previous update will still be visible in the lower right corner using a less visible color.
  • -nl, --nolegend β€” yeets the legend out of the image. You know the one β€” that little rx/tx colour-mapping key? Gone. Bye. 🫢
  • -o, --output file β€” writes the image to file and then dips out (exits). The image format is picked from the file extension you give it, so if you name it "image.png" you get png because of the .png at the end. And honestly? png is the moment β€” usually the smallest file size without losing any detail or sneaking in compression artifacts πŸ’…. Bonus: if you pass "-" as file, the output goes to stdout instead, and png image format is used in that case.
  • -ru, --rateunit [mode] β€” swaps the configured rate unit. Rate set to show in bytes? Now it's bits. Rate set to show in bits? Now it's bytes. Flip mode activated ✨. Alternatively you can pass mode as 0 or 1 to pick bytes (0) or bits (1) regardless of whatever the configuration file says β€” main character energy, ignoring the config entirely.
  • --scale percent β€” scales the output to the given percent, which literally just means your image ends up smaller or bigger than the default size.
  • -S, --small β€” small fonts in the output. tiny. adorable. readable. πŸŽ€
  • --style number β€” changes the content and style of outputs. Set number to 3 and you get the average traffic rate shown in all outputs where that's supported. Any other value shows bar graphics instead.
  • -s, --summary β€” outputs the traffic statistics summary. the classic. the icon. πŸ‘‘
  • -t, --top [limit] β€” outputs the all-time top traffic days. The list is limited to 10 entries unless it's configured otherwise, or unless you use the optional limit parameter. Set limit to 0 and every entry stored in the database gets shown. Use it with --begin and optionally with --end and the list is generated from the daily data instead of separate top entries β€” and just so you know, the availability of daily data is what defines the boundaries that the date-specific query can access. no cap. πŸ—“οΈ
  • --transparent [enabled] β€” toggles background colour transparency, depending on the TransparentBg setting in the configuration file. Or pass 0 or 1 as the enabled parameter to disable (0) or enable (1) transparency regardless of what the configuration file says. choose your own adventure fr fr.
  • -v, --version β€” shows the current version.
  • -vs, --vsummary [graph] β€” outputs the traffic summary with the graph selected by the SummaryGraph setting in the configuration file below it, in a vertical layout. The optional graph parameter overrides the configuration file setting. Available graphs: 0 = hours, 1 = 5 minutes. πŸ¦‹
  • -y, --years [limit] β€” outputs traffic statistics on a yearly basis for the last years. The list shows all entries by default unless it's configured otherwise or unless you use the optional limit parameter. Set limit to 0 and all entries stored in the database get shown too.
  • -?, --help β€” shows a command option summary. the "wait what was that flag again" saviour πŸ™ˆ

🌸 FILES 🌸

  • /var/lib/vnstat/ β€” the default database directory on Linux. On BSD systems the compile-time default is /var/db/vnstat unless somebody overrode it at build time.

Configuration file locations and search order? That whole saga is described in vnstat.conf(5). go read it bestie, it's giving essential lore πŸ“–


✨ EXAMPLES ✨

vnstati -s -i eth0 -o /tmp/vnstat.png

Outputs traffic summary for interface eth0 to file /tmp/vnstat.png.


vnstati -vs -i eth0+eth1+eth2 -o /tmp/vnstat.png

Outputs traffic summary with hourly data under the normal summary, for a merge of interfaces eth0, eth1 and eth2, to file /tmp/vnstat.png. merging interfaces is so iconic πŸ’œ


vnstati -h -c 15 -o /tmp/vnstat_h.png

Outputs hourly traffic statistics for the default interface to file /tmp/vnstat_h.png β€” but only if that file hasn't been updated within the last 15 minutes. cache check, slay.


vnstati -d -ne -nh -o -

Outputs daily traffic statistics for the default interface to standard output (stdout), without displaying the header section and without the edges.


vnstati -m --config /home/me/vnstat.cfg -o -

Outputs monthly traffic statistics for the default interface specified in configuration file /home/me/vnstat.cfg to standard output (stdout).


🫢 RESTRICTIONS 🫢

Heads up, bestie β€” read this before you blame yourself.

Depending on the built-in fonts the GD library provides, not all characters may end up shown correctly when a UTF-8 locale is used. Configuring a Unicode capable TrueType font with FontFile or --font avoids this limitation for rendered UTF-8 text. so set the font and let it cook πŸ“

Using long date output formats may cause misalignment or clipping in the shown columns if the length of the date exceeds the fixed size allocation. the columns have a size limit and the date is not respecting it 😭

Scaling an image when background transparency is enabled may not result in transparency being retained. that's just the vibe check it fails, ngl πŸ’€


πŸ‘‘ AUTHOR πŸ‘‘

Teemu Toivola <tst at iki dot fi>


🌈 SEE ALSO 🌈

vnstat(1), vnstatd(8), vnstat.conf(5), units(7)


and that's the whole page, bestie β€” this was vnstati(1), version 2.14, dated OCTOBER 2026 πŸ’– go make some pretty graphs, you absolute icon. periodt. βœ¨πŸŽ€

πŸ“¦ where this page comes from