In regard to: Re: [Networker] Linux does not report the client version in...:
Tim,
Thank you very much.
You really saved me.
You're welcome -- Davina was the one that provided the real value, by
posting the original 'ask the client directly' trick a few years ago.
I just turned it into a script that's easy to run.
BTW, I had forgotten until I looked through my nsr utility scripts that
I actually have a script to report the client OS and version. It doesn't
contact the client directly, though -- it goes against what the server has
on record. That would be easy to fix, though. It requires perl rather
than straight shell, since formatted output is a little easier with perl.
Tim
--
Tim Mooney Tim.Mooney AT ndsu DOT edu
Information Technology Services (701) 231-1076 (Voice)
Room 242-J6, IACC Building (701) 231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164
#!/usr/bin/perl -w
# Author: Tim Mooney <Tim.Mooney AT ndsu DOT edu>
use strict;
use POSIX qw(tmpnam);
if ($#ARGV > -1) {
print STDERR "$0: usage: nsr_osver_list\n";
exit(1);
}
use vars qw($line $current_client $current_os $tmpfile $nsradmin_cmd
$current_version);
$nsradmin_cmd = '/usr/sbin/nsradmin';
#
# TVM: feed the following to nsradmin.
#
$tmpfile = POSIX::tmpnam();
open(QFILE, ">$tmpfile") or die "Can't create temporary file $tmpfile: $!\n";
print QFILE 'option Dynamic', "\n";
print QFILE 'option Hidden', "\n";
print QFILE '. type: NSR Client', "\n";
print QFILE 'show Name; client OS type; NetWorker version', "\n";
print QFILE 'print', "\n";
close(QFILE) or die "close failed for $tmpfile: $!\n";
#
# Now run nsradmin with this query.
#
open(NSRADMIN, "$nsradmin_cmd -i $tmpfile |") or
die "Can't pipe from nsradmin: $!\n";
while (defined($line=<NSRADMIN>)) {
chomp($line);
#print "$line\n";
if ($line =~ /^\s*name: (.*);\s*$/i) {
$current_client = $1;
}
if ($line =~ /^\s*NetWorker version: (.*);\s*$/i) {
$current_version = $1;
} elsif ($line =~ /^\s*client OS type: (.*);\s*$/i) {
$current_os = $1;
}
if ( ($line =~ /^\s*$/) and (defined($current_client) ) ) {
printf "%-35.35s %-25.25s %s\n", "$current_client",
"$current_os", "$current_version";
undef($current_client);
$current_version="";
$current_os="";
}
}
close(NSRADMIN) or
print STDERR "$0: $nsradmin_cmd returned $?: $!\n";
#unlink($tmpfile);
To sign off this list, send email to listserv AT listserv.temple DOT edu and type
"signoff networker" in the body of the email. Please write to networker-request
AT listserv.temple DOT edu if you have any problems with this list. You can access the
archives at http://listserv.temple.edu/archives/networker.html or
via RSS at http://listserv.temple.edu/cgi-bin/wa?RSS&L=NETWORKER
|