Add the following line to /etc/services:
stat 1024/tcp # check network stats
Add the following line to /etc/inetd.conf (this assumes you copied the
script to /sbin/):
stat stream tcp nowait root /usr/sbin/tcpd /sbin/stat.sh
That's all. Of course, this only works if you have inetd running...
I'm not aware of any security holes being opened by adding this to inetd (aside from running inetd at all). If you know of any problems this approach might cause, please let me know.
You should probably also take a look at /etc/hosts.allow and also your firewall-rules to make sure that connections from your client to that host are actually allowed.
EigerStein users: LrpStat will not work with the default hosts.allow file
on EigerStein. You'll have to change
sh-httpd: 192.168.1.0/255.255.255.0
to
sh-httpd: 192.168.1.0/255.255.255.0
stat.sh: 192.168.1.0/255.255.255.0
#!/bin/sh -e trap "exit 1" 1 trap "exit 1" 2 sleepTime=1; if [ -n "$1" ] ; then sleepTime=$1 fi while [ 1 ] do cat /proc/net/dev echo "#" sleep $sleepTime doneThis version of the script accepts a parameter that specifies the time (in seconds) between measurements. The default is 1. If you want 5 seconds between measurements, you would specify
stat stream tcp nowait root /usr/sbin/tcpd /sbin/stat.sh 5in inetd.conf
Note: since there are no timestamps sent with the data (for the shell script, the C-program does send a timestamp), specifying the time is not very accurate, since this doesn't say when the java program actually receives the data (and for data without a timestamp, it uses the time since the last packet has arrived to build its own timestamp).
If you want to use this, you'll have to change the program-name specified in /etc/inetd.conf, since the instructions above assume you're using the script.
The makefile creates two versions (at least on my system, probably not on yours, unless you have SuSE Linux with the glibc 2.0 compatibility package installed). The first version, that is copied into glibc/ and is compiled with the standard cc and linked against whatever libraries you have on your system.
The second, which is put in glibc20/ uses the compiler from the glibc20 compatibility package and is linked against glibc2.0 (so it works on LRP/LEAF).
There are also isdn-versions, with special isdn-features enabled (check the makefile if you want to build those yourself).
Since version 0.11, the c-program also formats the cpu-usage as a "virtual" interface (name cpu0), which can be used to display cpu-usage in a graph. See also the DEVx_PERCENT parameter in the html-file.
If you have more than one cpu, the first two are displayed as device "cpu0" (the first cpu will be presented as "incoming traffic", the second as "outgoing traffic"). The next two as device "cpu1" and so on.