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__
|