Great advice. Allowed me to throw together the add/delete from group function without too much difficulty:
sub manageGroup {
my $parser = XML::LibXML->new();
my $dom = $parser->parse_string($_[0]->QueryXml('SELECT Uri FROM Orion.Nodes WHERE NodeID=@id', {'id'=>$_[3]}));
my $xpc = XML::LibXML::XPathContext->new($dom);
$xpc->registerNs("s", "http://schemas.solarwinds.com/2007/08/informationservice");
my $nodeUri = $xpc->findvalue("//s:data/s:row/s:c0");
if($_[1] eq "Add"){
my $memberDefinitionInfo = SOAP::Data->type('xml'=>
"<MemberDefinitionInfo xmlns='http://schemas.solarwinds.com/2008/Orion'>
<Name></Name>
<Definition>".$nodeUri."</Definition>
</MemberDefinitionInfo>"
);
return $_[0]->Invoke("Orion.Container", "AddDefinition", [$_[2], $memberDefinitionInfo]);
}elsif($_[1] eq "Delete"){
$dom = $parser->parse_string($_[0]->QueryXml('SELECT DefinitionID FROM Orion.ContainerMemberDefinition WHERE Definition=@id AND ContainerID=@container', {'id'=>$nodeUri, 'container'=>$_[2]}));
my @DEFIDS = $dom->getElementsByTagName("c0");
if (scalar(@DEFIDS) == 1){
return $_[0]->Invoke("Orion.Container", "DeleteDefinition", [scalar($DEFIDS[0]->textContent)]);
}else{
print "Error! Found ".scalar(@DEFIDS)." definition ID's for that node / container combo.\n";
}
}
}
my $swis = SW::InformationService->new();
$swis->outputxml("true");
$swis->proxy("https://".$hostname.$endpoint);
$swis->proxy->http_request->authorization_basic($username, $password);
#print manageGroup($swis, "Add", "84", "12929");
#print manageGroup($swis, "Delete", "84", "12929");
Thanks again.