|
NAMEdarkstat - network statistics gathererSYNOPSISdarkstat [ -i interface ] [ -r file ] [ --snaplen bytes ] [ --pppoe ] [ --syslog ] [ --verbose ] [ --no-daemon ] [ --no-promisc ] [ --no-dns ] [ --no-macs ] [ --no-lastseen ] [ -p port ] [ -b bindaddr ] [ --base path ] [ -f filter ] [ -l network/netmask ] [ --local-only ] [ --chroot dir ] [ --user username ] [ --daylog filename ] [ --import filename ] [ --export filename ] [ --pidfile filename ] [ --hosts-max count ] [ --hosts-keep count ] [ --ports-max count ] [ --ports-keep count ] [ --highest-port port ] [ --wait secs ] [ --hexdump ]DESCRIPTIONdarkstat is a packet sniffer that runs as a background process, gathers all sorts of statistics about network usage, and serves them over HTTP.All settings are passed on the commandline. OPTIONS
Specify the path of the base URL. This can be useful if
darkstat is accessed via a reverse proxy.
For example, if you use Apache's mod_proxy and want to avoid a complicated setup with mod_proxy_html (and mod_header to unset the Accept-Encoding header), just set the base path to something like stats and use a config similar to the following snippet:
The default is / (i.e. the root).
The rule is that if ip_addr & netmask == network, then that address is considered local. See the usage example below.
For security reasons, this directory should be empty, and the user that darkstat is running as should not have write access to it. However, if you wish to use --daylog or --export, darkstat will need write access to the chroot. If you are uncomfortable with the security implications, don't use any functionality that requires write access.
For security reasons, this should not be root.
Log daily traffic statistics into the named file,
relative to the chroot directory. If you wish to use --daylog, you must
first specify a --chroot directory, and it must be writeable by the
darkstat user. A writeable chroot has security implications; if you are
uncomfortable with this, do not use the --daylog functionality.
If the daylog argument is not specified, no logging is performed. The daylog format is: localtime|time_t|bytes_in|bytes_out|pkts_in|pkts_outs Lines starting with a # are comments stating when logging started and stopped.
Creates a file containing the process ID of
darkstat. This file will be unlinked upon clean shutdown. As with all
pidfiles, if darkstat dies uncleanly, a stale pidfile can be left over.
For example, start darkstat with:
And stop with:
By default, kill(1) will send SIGTERM, which will cause darkstat to shut down cleanly.
You should start darkstat after the capture interface has come up. If you can't, specifying the --wait option will make darkstat sleep up to the specified number of seconds for the interface to become ready. Zero means wait indefinitely.
USAGE EXAMPLESTo gather statistics on the fxp0 interface:
We want to account for traffic on the Internet-facing interface, but only serve web pages to our private local network where we have the IP address 192.168.0.1:
We want to serve web pages on the standard HTTP port:
We are on Optus (cable) and don't want to account for the constant ARP traffic we are receiving:
We only want to account for SSH traffic:
We don't want to account for traffic between internal IPs:
(For a full reference on filter syntax, refer to the tcpdump(1) manpage) We have a network consisting of a gateway server (192.168.1.1) and a few workstations (192.168.1.2, 192.168.1.3, etc.) and we want to graph all traffic entering and leaving the local network, not just the gateway server (which is running darkstat):
On some systems, we can't capture on a "decoded" interface but only on nas0 which returns PPPoE encapsulated packets. Do PPPoE decoding, and override the local IP manually since it cannot be automatically detected. Note the /32 netmask:
SIGNALSTo shut darkstat down cleanly, send a SIGTERM or SIGINT signal to the darkstat parent process.Sending the SIGUSR1 signal will cause darkstat to empty out its in-memory database. If an --export file was set, it will first save the database to file. Sending SIGUSR2 will save the database without emptying it. FREQUENTLY ASKED QUESTIONSHow many bytes does each bar on the graph represent?Hover your mouse cursor over a bar and you should get a tooltip saying exactly how many bytes in and out the bar represents.Why aren't there labels / tics / a scale on the graphs?Because implementing them is hard. And doing so correctly, and in a way that works across all browsers, looks pretty much impossible.I might attempt it some day. In the meantime, patches would be gladly accepted. Why are the graphs blank? All the bars are zero.The graphs only show traffic in/out of the local host, which is determined by getting the IP address of the interface you're sniffing on.You can use the -l argument to override the local address for accounting purposes. You can also use it to do accounting for a whole subnet by specifying an appropriate netmask. SEE ALSOtcpdump(1)HISTORYdarkstat was written in 2001, largely as a result of a certain Australian cable Internet provider introducing a 3GB monthly traffic limit.AUTHORSEmil Mikulic and others. (see the AUTHORS file)WEBSITEhttps://unix4lyfe.org/darkstat/
Visit the GSP FreeBSD Man Page Interface. |