Patchwork gnu: Add nethogs.

login
register
mail settings
Submitter Arun
Date Oct. 30, 2016, 7:16 a.m.
Message ID <20161030071645.5634-1-arunisaac@systemreboot.net>
Download mbox | patch
Permalink /patch/17019/
State New
Headers show

Comments

Arun - Oct. 30, 2016, 7:16 a.m.
* gnu/packages/networking.scm (nethogs): New variable.
---
 gnu/packages/networking.scm | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
Arun - Oct. 30, 2016, 7:26 a.m.
Arun Isaac writes:

> +    (arguments
> +     `(#:make-flags `("CC=gcc"
> +                      ,(string-append "PREFIX=" %output))
> +       #:phases
> +       (modify-phases %standard-phases
> +         (delete 'configure))))

Currently, the nethogs binary goes to /sbin. Should I make it go to
/bin? I'll have to run substitute* on src/MakeApp.mk for that.
Marius Bakke - Oct. 30, 2016, 12:18 p.m.
Arun Isaac <arunisaac@systemreboot.net> writes:

> Arun Isaac writes:
>
>> +    (arguments
>> +     `(#:make-flags `("CC=gcc"
>> +                      ,(string-append "PREFIX=" %output))
>> +       #:phases
>> +       (modify-phases %standard-phases
>> +         (delete 'configure))))
>
> Currently, the nethogs binary goes to /sbin. Should I make it go to
> /bin? I'll have to run substitute* on src/MakeApp.mk for that.

I am in favor of this. Maybe in the long run we can restore sbin to its
former glory, that is static binaries ;)

Other than that this package looks great. I'm not sure how bash knows to
tab-complete my network interfaces, but I'm not complaining! :)

One minor suggestion, feel free to disregard this: Perhaps synopsis
could be "Per-process bandwidth monitor" and then "for Linux" added to
the first sentence of the description.
Alex Kost - Oct. 30, 2016, 1:40 p.m.
Arun Isaac (2016-10-30 12:56 +0530) wrote:

> Arun Isaac writes:
>
>> +    (arguments
>> +     `(#:make-flags `("CC=gcc"
>> +                      ,(string-append "PREFIX=" %output))
>> +       #:phases
>> +       (modify-phases %standard-phases
>> +         (delete 'configure))))
>
> Currently, the nethogs binary goes to /sbin. Should I make it go to
> /bin? I'll have to run substitute* on src/MakeApp.mk for that.

I would leave it in /sbin.  It's not a problem, and there are other
packages that put binaries there, so I think we shouldn't modify an
upstream choice for this.

Patch

diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index ac88673..89641fa 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -991,3 +991,39 @@  the bandwidth, loss, and other parameters.")
                    license:ncsa              ; src/{units,iperf_locale,tcp_window_size}.c
                    license:expat             ; src/{cjson,net}.[ch]
                    license:public-domain)))) ; src/portable_endian.h
+
+(define-public nethogs
+  (package
+    (name "nethogs")
+    (version "0.8.5")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://github.com/raboof/nethogs/archive/v"
+                    version ".tar.gz"))
+              (sha256
+               (base32
+                "1k4x8r7s4dgcb6n2rjn28h2yyij92mwm69phncl3597cdxr954va"))
+              (file-name (string-append name "-" version ".tar.gz"))))
+    (build-system gnu-build-system)
+    (inputs
+     `(("libpcap" ,libpcap)
+       ("ncurses" ,ncurses)))
+    (arguments
+     `(#:make-flags `("CC=gcc"
+                      ,(string-append "PREFIX=" %output))
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure))))
+    (home-page "https://github.com/raboof/nethogs")
+    (synopsis "Linux 'net top' tool")
+    (description "NetHogs is a small 'net top' tool.  Instead of
+breaking the traffic down per protocol or per subnet, like most tools
+do, it groups bandwidth by process.
+
+NetHogs does not rely on a special kernel module to be loaded.  If
+there's suddenly a lot of network traffic, you can fire up NetHogs and
+immediately see which PID is causing this.  This makes it easy to
+identify programs that have gone wild and are suddenly taking up your
+bandwidth.")
+    (license license:gpl2+)))