
open(ELEMS, "/afs/club/usr/tylerni7/readable/periodic_list");
open(PINGS, ">/afs/club/usr/tylerni7/readable/server_statuses");
#open(DISK, ">/afs/club/usr/tylerni7/readable/disk_statuses");
#open(UPTIME, ">/afs/club/usr/tylerni7/readable/uptime_statuses");
#open(LOAD, ">/afs/club/usr/tylerni7/readable/load_statuses");

foreach my $elem (<ELEMS>) {
	if ($elem =~ /(\w+) \w+/) {
		$server = $1;
		my $pingResponse = `ping $server -c 1 -i .2`;
		$pingResponse =~  m/.* (.*?)% packet loss.*/gi;
		#not idea, but this will pring "servername packetpercentlost" if found, and "servername servername" otherwise
		print PINGS "$server  $1\n";

		#now that we know if the server is up...
#		if ($1 =~ m/^0$/) {
#			my $diskInfo = `ssh $server df -h | head -n 2 | tail -n 1 | awk {'print \$4" "\$5'}`;
#			print DISK "$server $diskInfo\n";
#		}
	}
} 

close(PINGS);
#close(DISK);
#close(UPTIME);
#close(LOAD);
close(ELEMS);

