How can I find what is the least amount of XML to pass to PluginConfigurations?
Here is what I pass: and I get a bad_request error. Basically what I need to know is the bare min, I want to pass a IP address to StartDiscovery and then point it to an already existing Discovery Profile, do not want to create one.
my $discoveryProfileXml = <<"END";
<CorePluginConfigurationContext xmlns:i='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://schemas.solarwinds.com/2012/Orion/Core'>
<BulkList>
<string>$ipAddress</string>
</BulkList>
<IpRanges />
<Subnets />
<Credentials />
<WmiRetriesCount>0</WmiRetriesCount>
<WmiRetryIntervalMiliseconds>0</WmiRetryIntervalMiliseconds>
</CorePluginConfigurationContext>
END
*****************************************
my @pluginConfigurationItems = ({ PluginConfigurationItem => "$discoveryProfileXml" });
my %startDiscoveryConfiguration = (
Name => 'Production Profile 1' ,
EngineID => $engineID,
JobTimeoutSeconds => 3600,
SearchTimeoutMiliseconds => 2000,
SnmpTimeoutMiliseconds => 3000,
SnmpRetries => 1,
RepeatIntervalMiliseconds => 1800,
SnmpPort => 161,
HopCount => 0,
PreferredSnmpVersion => 'SNMP2c',
DisableIcmp => 0,
AllowDuplicateNodes => 1,
IsAutoImport => 1,
IsHidden => 0,
PluginConfigurations => \@pluginConfigurationItems
);
my @verbArguments = (\%startDiscoveryConfiguration);
my $SWServer = $self->{engineconfig}->{OrionConfig}->{"$Region"};
my $swhostname = $SWServer->{OrionServer}; # fill in a hostname
my $swport = $SWServer->{JSONPort};
my $swprotocol = $SWServer->{Protocol};
my $SWCredentials = $self->get_credentials($SWServer->{CredentialSetName});
my $username = $SWCredentials->{username};
my $password = $self->decrypt_password($SWCredentials->{password});
my $uri = "https://$swhostname:$swport/SolarWinds/InformationService/v3/Json/Invoke/Orion.Discovery/StartDiscovery";
my $rest = REST::Client->new();
$rest->getUseragent()->proxy(['https']);
$rest->getUseragent()->ssl_opts(verify_hostname => 0);
my $headers = {
Authorization => 'Basic ' . MIME::Base64::encode_base64($username . ':' . $password),
'Content-Type' => 'application/json'
};
my $json = JSON->new->allow_nonref->utf8;
my $json_text = $json->space_after->encode(\@verbArguments);
#print "$json_text\n";
my $response = $rest->POST($uri, $json_text, $headers);
print Dumper $response;