Is there a cli command for logging the status of a NIC - eth0
I would like to know if it's possible to create a continual log for a network interface card's status. That is whether it's up or down and time and date stamped if possible.
I'm wondering if there is a cli command that exists to do this
I've looked at "ethtool" but this only sets the parameters of the nic.
Also looked at the log files that I could find /dev/log var/log, but there is no mention of a status for eth0.
The sys file system provides *heaps* of information. For example /sys/class/net/eth1/operstate for up/down information
Or for a whole bunch of detailed information have a look at the files in /sys/class/net/eth0/statistics/
Thank you for the info evo2, certainly put me in the right direction.
Unfortunately /sys/class/net/eth0/operstate only provides the status of the
eth0 at the time of viewing and is not appended but update as the state changes.
I was hoping more along the lines of date and time stamp for status change,
similar to a startup / shutdown log under sys.
Depending on time interval, you could either create a cron job, or run a bash script.
If you only want to log changes, you could do more sophisticated stuff, probably using grep and sed.
|All times are GMT -5. The time now is 05:00 PM.|