I'm trying to capture the number of bytes transmitted and received on my eth0 interface for use with RRD. I'm using this source for the data:
[EMAIL PROTECTED]:~/rrdmonitoring$ cat /proc/net/dev Inter-| Receive | Transmit face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed lo:31738431 323299 0 0 0 0 0 0 31738431 323299 0 0 0 0 0 0 eth0:147992894 45634695 0 0 0 0 0 0 1722980290 70429910 0 0 4 0 0 0 sit0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [EMAIL PROTECTED]:~/rrdmonitoring$ When I try to grab just the number of received bytes on eth0, it duplicates the number: [EMAIL PROTECTED]:~/rrdmonitoring$ cat /proc/net/dev|perl -ne '/eth0:(\d+)\s+.*/; print $1;' [EMAIL PROTECTED]:~/rrdmonitoring$ Note that the number repeats after 9 digits. Any ideas why? Any suggestions on how to improve my script overall? I'm actually reduced to doing this, to grab the received and transmitted bytes: [EMAIL PROTECTED]:~/rrdmonitoring$ rrdtool update /var/log/rrd/wwweth0.rrd N:`cat /proc/net/dev|perl -ne 'm[eth0:(\d+).*]; print "$1";'`:`cat /proc/net/dev|perl -ne 'm[eth0:(\d+\s+){9}(\d+).*]; print "$1";'` ERROR: expected 2 data source readings (got 0) from 1735196319:... [EMAIL PROTECTED]:~/rrdmonitoring$ What I'd really like to do is just run the perl script once and return both values. The only way I know to interface this with rrd is to assign each of the values to shell variables, and I don't know how to do this within perl or in the shell. Thanks for your suggestions. -Kevin Zembower