views:

23

answers:

2

I need a tool/script to fetch network card configurations from multiple Linux machines, mostly Red Had Enterprise 5. I only know some basic bash, and I need something that can be run remotely pulling server names from a CSV. It also needs to be be run quickly and easily by non-technical types from a Windows machine. I've found WBEM/CMI/SBLIM, but I'd rather not write a whole C++ application. Can anyone point me to a tool or script that could accomplish this?

A: 

Can you give more details as to what information you need to pull? The various parameters to ifconfig give quite a lot of information about a Linux machine's network card configuration, so if you can do it that way it will be very easy. Simply write a script that converts the CSV into something white-space delimited, and then you can do something like:

#!/bin/bash

for host in $HOSTS ; do
    CARDINFO=`ssh $host 'ifconfig'`
    # Do whatever processing you need on CARDINFO here
done

That's a very rough sketch of the pseudocode. You'll also need to set up passwordless SSH on the hosts you want to access, but that's easy to do on Red Hat.

Adrian Petrescu
I'm still waiting on the config info that needs to be gathered. I'm more worried about pulling this off remotely, en masse, and from a Windows machine. After more Googling, SharpSSH seems like it may be a solution since the users will have Windows PowerShell on their computers, but I have yet to do extended reading on it. For finding the card info, I'll be sure to check ifconfig. Thanks!
Beege
Apologies for the delay. I need to find out if the box has multiple network interface cards and, if so, whether or not they're teamed. I also need to find if one NIC is set to active and the other is passive. It doesn't seem that ifconfig provides this info.
Beege
A: 

For Red Hat Enterprise Linux servers, you likely just need to take a copy of the files in /etc/sysconfig/networking/devices/ from each server. You can use an sftp client to accomplish that over ssh.

(The files are just easy-to-read text config files containing the network device configuration)

caf
Oh hey, found it. You pointed me in the right direction. /etc/sysconfig/network-scripts/ holds the configurations for each card individually, including the team (whose configuration file must be created). You tell the kernel about the bond in /etc/modprobe.conf. Sources: http://www.cyberciti.biz/tips/linux-bond-or-team-multiple-network-interfaces-nic-into-single-interface.html -- http://www.xcat.org/pipermail/xcat-user/2009-August/008479.html. But I also need to see if they're setup active/passive. Any ideas?
Beege
Got it. Calling "less /proc/net/bonding/bond0" outputs the bonding mode, where mode 1 is active/backup.
Beege
@Beege: Note that which NIC is "active" and which "passive" can change at any time, so it's not part of the static configuration.
caf