From owner-freebsd-net@freebsd.org Mon May 30 09:07:48 2016 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7A99B53C0F for ; Mon, 30 May 2016 09:07:48 +0000 (UTC) (envelope-from woodsb02@gmail.com) Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com [IPv6:2a00:1450:400c:c09::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5D4351729 for ; Mon, 30 May 2016 09:07:48 +0000 (UTC) (envelope-from woodsb02@gmail.com) Received: by mail-wm0-x22d.google.com with SMTP id n129so76630342wmn.1 for ; Mon, 30 May 2016 02:07:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=SoPWd1/ch47dRmv0NQDeGLwwUc+LyrkTBe1dztFsUSQ=; b=uDENHrTROQyjZTPlwqO2DHOfv3Wpq54Pe+TVu1msHODu++i3TZfHUsIUoTmJtHbYvL uaKLLeiiDBati3w9FCe/wOrqoglrg8zZbS18B9YFT0ux/zA35U7sdLWyxDxYMpsN5WUM Ez1RnI0++yx/LATWghNIRIwJ6VaFlgqIkWzNsYKHxcjiNwDA5QDb4vkiG6tFmi8en7XW mZKf7vTivu82qOZKQXgeSS1rO7yx0x+OBgu9Y+PhY+dBGjo6MnrrYUo8xDsIAeXUGgSp PcrnHgDDRub1Qp8rwLnS/dwiU3OlLBzJ9HnpwRkSJOKl4E+cCGzMZ22X/kGoghQ3PTar FRpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=SoPWd1/ch47dRmv0NQDeGLwwUc+LyrkTBe1dztFsUSQ=; b=VkSjb0lUkrgxOB5mV0N255Qd/cZGOmXd9fcIpoVop8frA8MxJvXYMoUd/YJLqRqHL+ NnsXRyjXc5QLuYnGeG3r71dPBQ/jM55xGbW3sqk+3lmRFwpm8/tCuo4KjJXDFfiVf/Pq icEULneFwIjbzlXCiJHxu7me87vvEOml+VSFrphE+eCxSI3KIrkoRwyJw/00iFs9EMzc gnkQ92ZYv1wSUZbxz2zBL0zbgtD0dCrv8q/TyTHH4yuiQvnBzlNfQr9TYyWmgDbZJlPC QGwXE+jlv/bSCv9IwBR/+11TBM5XfjifETFCGKYNcpsTFdaHe6ZwGAmqDMjVsLwsSINS /95g== X-Gm-Message-State: ALyK8tIlvD+v2xce4VKjEI1UZ0OEqblA6WFNlihqenVDuKcyNZNStCJMX4R11Qbr+xW7wfQfzS/45y2mK5LDKg== MIME-Version: 1.0 X-Received: by 10.28.94.194 with SMTP id s185mr10522926wmb.62.1464599267006; Mon, 30 May 2016 02:07:47 -0700 (PDT) Received: by 10.194.222.228 with HTTP; Mon, 30 May 2016 02:07:46 -0700 (PDT) In-Reply-To: References: Date: Mon, 30 May 2016 11:07:46 +0200 Message-ID: Subject: Is there a way to keep an account of which processes generate how much network traffic? From: Ben Woods To: Yuri Cc: "freebsd-net@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2016 09:07:48 -0000 On Monday, 30 May 2016, Yuri > wrote: > There is vnstat that does this by interface. > > But is there a way to do this by the application? This is because nearly > every packet that is sent through the system is sent on behalf of some > process running on the system. > > It would be nice to be able to see which applications (in general sense) > generate most traffic. > > I am fully aware that the link between pid and an "application" is vague > because some processes are run through some cryptic command lines. I am > just interested if anything exists in this area at all. > > > Yuri > Hi Yuri, There is an application called nethogs which does this on Linux, but the website says it makes heavy use of Linuxisms so won't work on BSD. I had a quick look at the code and couldn't immediately recognise the Linuxisms in question, but haven't done a thorough look. On FreeBSD, I tend to filter traffic by src and destination ip/port to determine how much traffic an application is using. Easiest solution I can think of: Use net-mgmt/darkstat. https://unix4lyfe.org/darkstat/ Slightly more complicated solution, but with potentially more power for filtering the data: Netflow/NfDump/NfSen https://forums.freebsd.org/threads/49724/ Good luck! Regards, Ben -- -- From: Benjamin Woods woodsb02@gmail.com