nv-l
[Top] [All Lists]

[nv-l] now (selling) commandline manage/unmanage for nv7.1

To: "'nv-l@lists.tivoli.com'" <nv-l@lists.tivoli.com>
Subject: [nv-l] now (selling) commandline manage/unmanage for nv7.1
From: REIBENSCHUH Alfred <alfred.reibenschuh@it-austria.com>
Date: Fri, 15 Feb 2002 17:07:43 +0100
hi!

just in case you ever wanted to do manage/unmanage from the command-line ...

this perl-script will accomplish this for netview 7.1 using the webserver :)

#!/usr/local/bin/perl
#
# by fredo <alfred.reibenschuh@it-austria.com>
#
# usage:
#       webmanage.pl manage oid1 oid2 ...
#       webmanage.pl unmanage oid1 oid2 ...
#
#
use XML::Simple;
use HTTP::GHTTP qw/:methods/;

($host,$port,$user,$pass)=qw( my-server my-port my-user my-password );

$conn=HTTP::GHTTP->new();

$conn->set_uri("http://$host:$port/netview/OpenMap";);
$conn->set_authinfo($user,$pass);
$conn->process_request;
%maps=();

my $ref = XMLin($conn->get_body);
if(ref($ref->{'map-info'}) eq 'ARRAY') {
        foreach $k (@{$ref->{'map-info'}}) {
                next unless($k->{permissions}=~/Write/);
                $maps{$k->{'map-name'}}=$k->{port};
                printf "Map: %s on port %s\n",$k->{'map-name'},$k->{port}
if($debug);
        }
} else {
        $k=$ref->{'map-info'};
        $maps{$k->{'map-name'}}=$k->{port} if($k->{permissions}=~/Write/);
        printf "Map: %s on port %s\n",$k->{'map-name'},$k->{port}
if($debug);
}

$map||='default';

$conn=HTTP::GHTTP->new();
$man=shift(@ARGV) eq 'manage' ? 'true' : 'false' ;
foreach $oid (@ARGV) {
 
$conn->set_uri("http://$host:$port/netview/MapServer/setManageState?mapPort=
$maps{$map}&doManage=$man&objectId=$oid");
        $conn->set_authinfo($user,$pass);
        $conn->process_request;
        printf "$oid / %d: %s\n",($conn->get_status());
}

__END__

<Prev in Thread] Current Thread [Next in Thread>
  • [nv-l] now (selling) commandline manage/unmanage for nv7.1, REIBENSCHUH Alfred <=

Archive operated by Skills 1st Ltd

See also: The NetView Web