Networker

Re: [Networker] getting a text list of clients out of Networker

2002-09-18 08:00:33
Subject: Re: [Networker] getting a text list of clients out of Networker
From: "Maarten Boot (CWEU-USERS/CWNL)" <Maarten_Boot AT NL.COMPUWARE DOT COM>
To: NETWORKER AT LISTMAIL.TEMPLE DOT EDU
Date: Wed, 18 Sep 2002 13:51:33 +0200
This is my script to get all defined clients from nsradmin
listing them with a scripts based on mminfo gives you also the deleted
clients, it might be that that is what you want

Maarten

Paul Crossman wrote:
>
> Is there a way to get a list of clients out of networker?
>
> Paul C.
> --
> Paul Crossman @ Wildfire Communications, Inc.
> Senior Unix Systems Administrator
> Phone & Fax:  781-778-3517
> Email:  pcrossma AT wildfire DOT com
>
> --
> Note: To sign off this list, send a "signoff" command via email
> to listserv AT listmail.temple DOT edu or visit the list's Web site at
> http://listmail.temple.edu/archives/networker.html where you can
> also view and post messages to the list.
> =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=

--
One of the problems with Java is that they swept a bit too much
of the innate complexity of life under the carpet of the libraries.
And so now they've had to replace the carpets several times.
(Larry

--
Note: To sign off this list, send a "signoff" command via email
to listserv AT listmail.temple DOT edu or visit the list's Web site at
http://listmail.temple.edu/archives/networker.html where you can
also view and post messages to the list.
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
Wall,http://interviews.slashdot.org/article.pl?sid=02/09/06/1343222)
#!/usr/bin/perl -w
# ==============================================================

use strict;
$\ = "\n";
$, = ' ';

# ==============================================================

my $SERVER="bagworm";
my $NSRADMIN="/usr/sbin/nsradmin";

# ==============================================================

my $Count= 1; # local static variable

sub mk_tmpf ($)
{
    # GLOBAL $Count;

    my $str = shift;
    my $tmpf="/tmp/_tmp.$$.$Count";
    $Count ++;

    open( TMPF, ">$tmpf") || die "FATAL: cannot open '$tmpf' , $!";
    if( $str ) {
        print TMPF $str;
    }
    close TMPF;

    return $tmpf;
}

sub get_clients ()
{
    my %clients = ();
    my @a = (
        ". type: NSR client",
        "show name",
        "print",
    );

    my $a = join("\n",@a);
    my $tmpf = mk_tmpf($a);
    my $cmd="$NSRADMIN -s $SERVER -i $tmpf ";

    open(INFO,"$cmd |") || die "FATAL: cannot start '$cmd', $!";
    my $name = "";
    while (<INFO>) {
        chop;

        if ( /\s*name:\s+\b(.+)\b\s*/ ) {
            $name = $1;
            $clients{$name} = $name;
        }
    }
    close(INFO);

    unlink $tmpf if -f $tmpf;

        return \%clients;
}

# @@ MAIN
{
    my $clients = &get_clients;

    foreach my $client (sort keys %{$clients} ) {
        print $client;
    }
}


--
Note: To sign off this list, send a "signoff" command via email
to listserv AT listmail.temple DOT edu or visit the list's Web site at
http://listmail.temple.edu/archives/networker.html where you can
also view and post messages to the list.
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=