mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 01:39:16 -04:00
Add pload, an X11 program to monitor network device statistics.
It graphs information using Athena stripchart widgets. PR: ports/72013 Submitted by: J.R. Oldroyd <fbsd@opal.com>
This commit is contained in:
parent
66e6413b16
commit
f30d42f081
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=119743
8 changed files with 238 additions and 0 deletions
|
@ -544,6 +544,7 @@
|
||||||
SUBDIR += pim6sd
|
SUBDIR += pim6sd
|
||||||
SUBDIR += pipsecd
|
SUBDIR += pipsecd
|
||||||
SUBDIR += plb
|
SUBDIR += plb
|
||||||
|
SUBDIR += pload
|
||||||
SUBDIR += plugdaemon
|
SUBDIR += plugdaemon
|
||||||
SUBDIR += pmf
|
SUBDIR += pmf
|
||||||
SUBDIR += poink
|
SUBDIR += poink
|
||||||
|
|
23
net/pload/Makefile
Normal file
23
net/pload/Makefile
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# New ports collection makefile for: pload
|
||||||
|
# Date created: 22 Septemper 2004
|
||||||
|
# Whom: J.R. Oldroyd <fbsd@opal.com>
|
||||||
|
#
|
||||||
|
# $FreeBSD$
|
||||||
|
#
|
||||||
|
|
||||||
|
PORTNAME= pload
|
||||||
|
PORTVERSION= 0.9.5
|
||||||
|
CATEGORIES= net sysutils
|
||||||
|
MASTER_SITES= http://www.engr.utk.edu/~mdsmith/pload/
|
||||||
|
|
||||||
|
MAINTAINER= fbsd@opal.com
|
||||||
|
COMMENT= An X11 program to display network traffic graphs
|
||||||
|
|
||||||
|
USE_IMAKE= yes
|
||||||
|
HAS_CONFIGURE= yes
|
||||||
|
|
||||||
|
MAN1= pload.1
|
||||||
|
MANCOMPRESSED= yes
|
||||||
|
PLIST_FILES= bin/pload
|
||||||
|
|
||||||
|
.include <bsd.port.mk>
|
2
net/pload/distinfo
Normal file
2
net/pload/distinfo
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
MD5 (pload-0.9.5.tar.gz) = f109f3984212627f9955d1ac57c7a4f7
|
||||||
|
SIZE (pload-0.9.5.tar.gz) = 22423
|
20
net/pload/files/patch-Imakefile
Normal file
20
net/pload/files/patch-Imakefile
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
diff -c Imakefile.orig Imakefile
|
||||||
|
*** Imakefile.orig Tue Feb 1 02:11:24 2000
|
||||||
|
--- Imakefile Tue Aug 3 10:02:12 2004
|
||||||
|
***************
|
||||||
|
*** 15,21 ****
|
||||||
|
|
||||||
|
ComplexProgramTarget(pload)
|
||||||
|
|
||||||
|
! distclean: clean
|
||||||
|
$(RM) Makefile osdefs.mk core \
|
||||||
|
pload-$(VER).tar.gz \
|
||||||
|
pload-$(VER)-1.i386.rpm \
|
||||||
|
--- 15,21 ----
|
||||||
|
|
||||||
|
ComplexProgramTarget(pload)
|
||||||
|
|
||||||
|
! distclean:: clean
|
||||||
|
$(RM) Makefile osdefs.mk core \
|
||||||
|
pload-$(VER).tar.gz \
|
||||||
|
pload-$(VER)-1.i386.rpm \
|
80
net/pload/files/patch-ioctl_stats.c
Normal file
80
net/pload/files/patch-ioctl_stats.c
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
--- ioctl_stat.c.orig Tue Feb 1 08:11:24 2000
|
||||||
|
+++ ioctl_stat.c Mon Oct 18 22:32:49 2004
|
||||||
|
@@ -30,6 +30,12 @@
|
||||||
|
#include <fcntl.h> /* open */
|
||||||
|
#include <sys/ioctl.h> /* ioctl */
|
||||||
|
#include <errno.h>
|
||||||
|
+#ifdef __FreeBSD__
|
||||||
|
+#include <sys/sysctl.h>
|
||||||
|
+#include <sys/socket.h>
|
||||||
|
+#include <net/if.h>
|
||||||
|
+#include <net/if_mib.h>
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#ifndef STREAMS /* Linux, FreeBSD, NetBSD, Ultrix */
|
||||||
|
# include <sys/socket.h> /* socket */
|
||||||
|
@@ -63,6 +69,16 @@
|
||||||
|
struct ifreq ifr;
|
||||||
|
struct ifpppstatsreq req;
|
||||||
|
|
||||||
|
+#ifdef __FreeBSD__
|
||||||
|
+ static int if_ix = -1;
|
||||||
|
+ struct ifmibdata ifmd;
|
||||||
|
+ size_t ifmd_sz = sizeof(ifmd);
|
||||||
|
+ int nr_ifs;
|
||||||
|
+ size_t nr_ifs_sz = sizeof(nr_ifs);
|
||||||
|
+ int name[6];
|
||||||
|
+ int i;
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
if (!ifd->s) getsocket(ifd);
|
||||||
|
|
||||||
|
memset(&ifr, 0, sizeof(ifr));
|
||||||
|
@@ -84,18 +100,36 @@
|
||||||
|
#define ifr_name ifr__name
|
||||||
|
#endif
|
||||||
|
|
||||||
|
- strncpy(req.ifr_name, ifd->device, sizeof(req.ifr_name));
|
||||||
|
- if (ioctl(ifd->s, SIOCGPPPSTATS, &req) != 0)
|
||||||
|
- {
|
||||||
|
- /* shouldn't fail if SIOCGIFFLAGS worked... */
|
||||||
|
- ifd->in_bytes = 0UL;
|
||||||
|
- ifd->out_bytes = 0UL;
|
||||||
|
- return;
|
||||||
|
+#ifdef __FreeBSD__
|
||||||
|
+ name[0] = CTL_NET;
|
||||||
|
+ name[1] = PF_LINK;
|
||||||
|
+ name[2] = NETLINK_GENERIC;
|
||||||
|
+ name[3] = IFMIB_IFDATA;
|
||||||
|
+ name[5] = IFDATA_GENERAL;
|
||||||
|
+
|
||||||
|
+ if (if_ix < 0) {
|
||||||
|
+ if (sysctlbyname("net.link.generic.system.ifcount", (void *) &nr_ifs, &nr_ifs_sz, (void *) 0, 0) < 0) {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ for (i = 1; i <= nr_ifs; i++) {
|
||||||
|
+ name[4] = i; /* row of the ifmib table */
|
||||||
|
+
|
||||||
|
+ if (sysctl(name, 6, (void *) &ifmd, &ifmd_sz, (void *) 0, 0) < 0) {
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+ if (strncmp(ifmd.ifmd_name, ifr.ifr_name, strlen(ifr.ifr_name)) == 0) {
|
||||||
|
+ if_ix = i;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
-
|
||||||
|
- ifd->in_bytes = (unsigned long)req.stats.p.ppp_ibytes;
|
||||||
|
- ifd->out_bytes = (unsigned long)req.stats.p.ppp_obytes;
|
||||||
|
-
|
||||||
|
+ name[4] = if_ix;
|
||||||
|
+ if (sysctl(name, 6, (void *) &ifmd, &ifmd_sz, (void *) 0, 0) >= 0) {
|
||||||
|
+ ifd->in_bytes = ifmd.ifmd_data.ifi_ibytes;
|
||||||
|
+ ifd->out_bytes = ifmd.ifmd_data.ifi_obytes;
|
||||||
|
+ }
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
73
net/pload/files/patch-pload.c
Normal file
73
net/pload/files/patch-pload.c
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
diff -c pload.c.orig pload.c
|
||||||
|
*** pload.c.orig Tue Feb 1 02:11:24 2000
|
||||||
|
--- pload.c Wed Sep 22 13:13:46 2004
|
||||||
|
***************
|
||||||
|
*** 596,608 ****
|
||||||
|
void do_total(char *b, double total)
|
||||||
|
{
|
||||||
|
if (total < 1024.0)
|
||||||
|
! sprintf(b, "%s%0.0f b", b, total);
|
||||||
|
else if (total < (1024.0*1024.0))
|
||||||
|
! sprintf(b, "%s%0.2f k", b, total/1024.0);
|
||||||
|
else if (total < (1024.0*1024.0*1024.0))
|
||||||
|
! sprintf(b, "%s%0.2f M", b, total/1024.0/1024.0);
|
||||||
|
else
|
||||||
|
! sprintf(b, "%s%0.2f G", b, total/1024.0/1024.0/1024.0);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
--- 596,608 ----
|
||||||
|
void do_total(char *b, double total)
|
||||||
|
{
|
||||||
|
if (total < 1024.0)
|
||||||
|
! sprintf(b, "%s%0.0f B", b, total);
|
||||||
|
else if (total < (1024.0*1024.0))
|
||||||
|
! sprintf(b, "%s%0.2f kB", b, total/1024.0);
|
||||||
|
else if (total < (1024.0*1024.0*1024.0))
|
||||||
|
! sprintf(b, "%s%0.2f MB", b, total/1024.0/1024.0);
|
||||||
|
else
|
||||||
|
! sprintf(b, "%s%0.2f GB", b, total/1024.0/1024.0/1024.0);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
***************
|
||||||
|
*** 610,622 ****
|
||||||
|
void do_rate(char *b, double rate)
|
||||||
|
{
|
||||||
|
if (rate < 1024.0)
|
||||||
|
! sprintf(b, "%s%0.0f b/s",b, rate);
|
||||||
|
else if (rate < (1024.0*1024.0))
|
||||||
|
! sprintf(b, "%s%0.2f k/s",b, rate/1024.0);
|
||||||
|
else if (rate < (1024.0*1024.0*1024.0))
|
||||||
|
! sprintf(b, "%s%0.2f M/s",b, rate/1024.0/1024.0);
|
||||||
|
else
|
||||||
|
! sprintf(b, "%s%0.2f G/s", b, rate/1024.0/1024.0/1024.0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
--- 610,622 ----
|
||||||
|
void do_rate(char *b, double rate)
|
||||||
|
{
|
||||||
|
if (rate < 1024.0)
|
||||||
|
! sprintf(b, "%s%0.0f B/s",b, rate);
|
||||||
|
else if (rate < (1024.0*1024.0))
|
||||||
|
! sprintf(b, "%s%0.2f kB/s",b, rate/1024.0);
|
||||||
|
else if (rate < (1024.0*1024.0*1024.0))
|
||||||
|
! sprintf(b, "%s%0.2f MB/s",b, rate/1024.0/1024.0);
|
||||||
|
else
|
||||||
|
! sprintf(b, "%s%0.2f GB/s", b, rate/1024.0/1024.0/1024.0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
***************
|
||||||
|
*** 643,648 ****
|
||||||
|
--- 643,651 ----
|
||||||
|
break;
|
||||||
|
case 'M':
|
||||||
|
do_rate(buff, max);
|
||||||
|
+ break;
|
||||||
|
+ case 'd':
|
||||||
|
+ sprintf(buff, "%s", resources.device);
|
||||||
|
break;
|
||||||
|
case '%': /* literal % */
|
||||||
|
i = strlen(buff);
|
33
net/pload/files/patch-pload.man
Normal file
33
net/pload/files/patch-pload.man
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
--- pload.man.orig Tue Feb 1 02:11:24 2000
|
||||||
|
+++ pload.man Wed Sep 22 16:44:12 2004
|
||||||
|
@@ -18,7 +18,7 @@
|
||||||
|
.TH PLOAD 1 "" "January 2000"
|
||||||
|
|
||||||
|
.SH NAME
|
||||||
|
-pload \- display ppp throughput statistics in an X window
|
||||||
|
+pload \- display network interface statistics in an X window
|
||||||
|
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.ta 6n
|
||||||
|
@@ -30,9 +30,9 @@
|
||||||
|
[-iformat \fIfmt\fP] [-oformat \fIfmt\fP]
|
||||||
|
|
||||||
|
.SH DESCRIPTION
|
||||||
|
-The \fBpload\fP program displays information about network interface (ppp) statistics.
|
||||||
|
-Additionally, for Linux 2.2 it can display statistics for any interface that
|
||||||
|
-reports to /proc/net/dev .
|
||||||
|
+The \fBpload\fP program displays network throughput statistics in an X window
|
||||||
|
+Athena stripchart graph.
|
||||||
|
+On FreeBSD, \fBpload\fP can handle any network interface.
|
||||||
|
|
||||||
|
.SH OPTIONS
|
||||||
|
.PP
|
||||||
|
@@ -144,7 +144,7 @@
|
||||||
|
.TP 8
|
||||||
|
.B \-iformat \fIfmt\fP
|
||||||
|
Use string \fIfmt\fP for the inbound label. The \fIfmt\fP string will be displayed
|
||||||
|
-literally with the special tags %t %r and %M expanding to the interface total, current
|
||||||
|
+literally with the special tags %d %t %r and %M expanding to the interface name, interface total, current
|
||||||
|
rate, and maximum rate respectively. The default is "%t %r in".
|
||||||
|
|
||||||
|
.TP 8
|
6
net/pload/pkg-descr
Normal file
6
net/pload/pkg-descr
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
Pload is an X11 program to monitor network device statistics. It
|
||||||
|
graphs information using Athena stripchart widgets.
|
||||||
|
|
||||||
|
Original author: Matt Smith <mdsmith@engr.utk.edu>
|
||||||
|
|
||||||
|
WWW: http://www.engr.utk.edu/~mdsmith/pload/
|
Loading…
Add table
Reference in a new issue