1
1
I am currently writing a bash script (for Nagios), and I would like to be able to detect if specific network cards are up or not.
My best guess is to do something like this:
ifconfig eth0 | grep UP | wc -l
or:
ethtool eth0 | grep "Link detected: yes" | wc -l
Are either/both of those reliable ways of testing if the network card is up, or is there a better option? Perhaps there is a flag on ethtool
which will do precisely what I want?
2Networks no longer use classes and colons don't need to be escaped – Paused until further notice. – 2010-09-17T12:33:20.377
where you wrote "for a class C internal ip address" As they don't use classes anymore, that should read for a /24 internal ip address. – barlop – 2014-05-25T01:34:24.593