I'm working on building our maintenance procedures and one of the things we'd like to do to keep things clean is figure out how a device got added to Spectrum. In particular, we'd like to be able to remove a device without that device getting rediscovered when one of the discovery profiles reruns according to its schedule. I've devised a pretty complicated way of doing it, but I was wondering if there was something built into the product that already does it. Essentially, I need a way to find which discovery profile (on which landscape) contains a given IP address.
In the event that there is no way to do this, I want to find out if there is a way to use the modelinggateway to export all the discovery profile XML files. My current process looks like this:
- Export all the discovery profiles to XML manually from the discovery console <--this is what I'd like to see if i can automate through the modeling gateway
- Run a perl script to dump the IP addresses, discovery profile names, and landscape names into a single CSV
- Search the CSV to find out in which discovery profile(s) and landscape(s) the IP address exists
Since I'm exporting manually, I end up with a single XML file for each landscape. So, I have a batch file that calls the perl script for each XML:
for %%A in (*.xml) do (
perl parserparser.pl %%A
type %%A.csv >> output.csv
del /q %%A.csv
)
Here's the perl script:
#!/usr/bin/perl
my $currlscape;$currentdp;open (INFILE, @ARGV[0]);open (OUTFILE, ">" . @ARGV[0] . ".csv");
while (<INFILE>) {
chomp;
if ($_ =~ m!<SPECTRUM_Export landscape_name="(.*)" landscape_handle="0x......">!) {$currlscape = $1;}
if ($_ =~ m!<Discovery_Model name="(.*)" model_type=".*" model_handle="0x......" >!) {$currentdp = $1;}
if ($_ =~ m!<value>(\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b)</value>!){print OUTFILE "$1,\"$currentdp\",$currlscape\n";}
}
close (INFILE);close (OUTFILE);
Eventually, I'd use a cron job to run the modelling gateway to export the discovery profile, then run the perl script, then post the data to some web page where my process workers can reference it.
Another question I'd have is whether or not I'd be able to do this all from the MLS or if I'd have to set it up on each landscape then aggregate them together somehow.