A large educational institution on the East Coast functions as an ISP to parts of its large network. They wanted to determine which devices changed in the past 2 hours so that the NOC can be proactively enabled and do a configuration comparison faster for troubleshooting purposes.
The .netmri.yml file with the user’s credentials needs to be in the home directory of your local Linux machine. This file enables credential passing between the local machine and the NetMRI API. For additional information, please consult the NetMRI API Guide that is posted in the technical documentation section of Infoblox’s Support site.
use NetMRI::API; # comment this out if you are running HTTP only $ENV{'PERL_LWP_SSL_VERIFY_HOSTNAME'} = 0; # Configure .netmri.yml with your # url: http://netmri # username: admin # password: secret my $netmri = new NetMRI::API({api_version =>"2.7"}); #this will query Network Analysis Changes to grab the information need to parse my @changes = $netmri->broker->ChangeSummaryNetworkAnalysisGrid->index({ starttime =>"2 hours ago", endtime =>"now", }); #For each change in the ChangesSummaryNetworkAnalysisGrid, we will only look for Change Method # contains "Config" and save the config to a file with DeviceName as the file name foreach my $change (@changes) { if ( $change->ChangeMethod =~ /Config/ ) { my $text = $netmri->broker-> device->saved_config_text(DeviceID=>$change->DeviceID) ->{saved_config_text}; #The statement below will get the device name that NetMRI uses, and will save the config # file to that device name my $save = $change->DeviceName; open (CONFIG, ">$save"); print CONFIG $text; close (CONFIG); } };