wmi alternative getting system info

minion

Well-Known Member
Joined
May 31, 2011
Messages
218
Reaction score
0
hey guys!

i need to get installation date of linux servers on our network, so im running sudo passwd -S sys | tail -1 | awk '{print $3}' to get date when sys user was created but have to login to 200 servers one by one and run this command. doesnt linux also have something like wmi which i can just run and get all system info? im on server 20 now and gatvol already, haha! :twisted:
 
A script?

Linux actually has a lot of management tools.
 
As ponder said make a simple script that loops over the IPs of the machines and runs your command for you. Make sure you save the results instead of displaying it on your screen.
 
A script?

Linux actually has a lot of management tools.

yes been thinking of maybe running script to get these details, for instance with wmi i can write batch script and pipe results to location. how can i do this from windows machine that got access to these linux servers to get these results?
 
ssh with key authentication and a shell script to loop through your ips redirect the output to stdout.

Code:
sub testSSH	
{
	my $ip = shift;
	my $success = 0;
	my $cmd = "[I]ssh -n -o NumberOfPasswordPrompts=0 -o PasswordAuthentication=no -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ConnectTimeout=10 -l [B]someuser[/B] -i [B]path_to_private_key[/B] $ip 'echo Success' 2>&1[/I]";
    my @r = `$cmd`;
    for (my $i=0;$i<@r;$i++) {
        chomp $r[$i];
        $r[$i] =~ s/\r//g;
        #$r[$i] = "\"".$r[$i]."\"";
    }
    my $ret = join("|",@r);
    return $ret;
}

This is a piece of perl I wrote to test if our SSH credentials were configured correctly.
The italic bit might be what you are interested in.

You can change the "echo Success" to what ever command you want to run.
 
hey guys!

i need to get installation date of linux servers on our network, so im running sudo passwd -S sys | tail -1 | awk '{print $3}' to get date when sys user was created but have to login to 200 servers one by one and run this command. doesnt linux also have something like wmi which i can just run and get all system info? im on server 20 now and gatvol already, haha! :twisted:

Write an Ansible playbook to do this.

All you need is SSH access.

http://www.ansible.com/home
 
Top
Sign up to the MyBroadband newsletter
X