Networker

Re: [Networker] Client Listing

2007-07-24 06:27:40
Subject: Re: [Networker] Client Listing
From: michael mcgearty <michaelmcgearty AT GMAIL DOT COM>
To: NETWORKER AT LISTSERV.TEMPLE DOT EDU
Date: Tue, 24 Jul 2007 11:21:55 +0100
Hi,

On our windows servers i just run the reporting from a unix/linux box
that is a client on the backup server. Or you can even use cygwin on a
windows box that is a client on your backups. makes reporting a lot
easier.

On linux/unix command line would be somthing like.
echo -e "show name;comments\nprint type:nsr client" |nsradmin -s
<windows  backup server> -i - | tr -s " " | sed 's/ name: //g'

(only use -e for the bash shell)

Rgd
MMG

On 7/23/07, Darren Dunham <ddunham AT taos DOT com> wrote:
> Hi all, I am looking to pull a client list from Networker using NSRADMIN
> and all I want is the client name and the comment fields.  I can get
> this running without issue, but the dump from nsradmin, in it's
> multi-line format is almost completely useless for manipulation in
> Excel.  Anyone know of an easy way to get this in a comma delimited
> format?  BTW, I am running on windows (just in case someone has some
> fancy script I might not be able to run).

You can run perl on windows (but you'll probably have to download it).
I'm afraid my VB skills are rather limited.

Here's an example.  You'd need to change the path to your nsradmin
binary on your system.  (Even on Windows, I recommend using forward
slashes (/) instead of backslashes (\) for the file components.  They
work just as well, and they don't have to be escaped.)

Also, you say *the* client name and comment fields.  You can have
multiple client instances, each with different comments.  This script
does no organization of the data, but just prints it.  Since you're
trying to put it in Excel, you can do the sorting or whatever in there.

#!/usr/bin/perl
use strict;
use warnings;

use IPC::Open2;

my $nsradmin = '/usr/sbin/nsradmin';

my ($rdr, $wtr);
my $pid = open2($rdr, $wtr, $nsradmin, '-i', '-');

print $wtr "show name;comment\n";
print $wtr "print type:nsr client\n";
close $wtr;

my $client;
while(<$rdr>)
{
  chomp;
  if (s/\\$//) # ends in backslash
    {
      $_ .= <$rdr>;
      chomp;
      redo;
    }
  if (/name\:\s*(.*);/) { $client = $1; next; }
  if (/comment\:\s*(.*);/) { print "$client,$1\n"; }
}

Enjoy!

--
Darren Dunham                                           ddunham AT taos DOT com
Senior Technical Consultant         TAOS            http://www.taos.com/
Got some Dr Pepper?                           San Francisco, CA bay area
         < This line left intentionally blank to confuse you. >

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



--
Regards
Michael McGearty

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