Reply
Accepted Solution

Copy file via SCP from NetMRI to a device

Expert
Posts: 42
6317     0

Hi,

 

is there a way to copy files directly from NetMRI by using SCP to a device in a CCS/Perl Script?

 

There are a lot of devices which are unable to download files on their disk but provide SCP access to upload files only.

 

I took a look at the latest NetMRI API 3 and found no methods to accomplish this task.

 

Thank you in advance

 

Re: Copy file via SCP from NetMRI to a device

Adviser
Posts: 57
6318     0

The files that needs to be copied, are they locally present in NetMRI ?

Re: Copy file via SCP from NetMRI to a device

Expert
Posts: 42
6318     0

Hi Rajiv,

 

well, I could copy them to the backup folder just like regular NetMRI updates to make them available locally. I would not see a problem there.

Re: Copy file via SCP from NetMRI to a device

Adviser
Posts: 57
6318     0

We don't need them to be present locally in NetMRI. Files from NetMRI can be copied to other devices by running the command "remoteCopy" from the admin shell. However, you have to do this one after the other and will not be practical if you have to this on lot of devices.

 

If another Router/Switch managed by NetMRI can be used as a TFTP server, then we can run CCS script like "Ad Hoc Command Batch" on that device. Command syntax can be something like the following

 

copy scp://$server/file_name copy_location:filename\r$scp_username\r\rn$scp_password\r

 

In short the command that will directly run on the Router/Switch, where the username and password for the destination server has to be chained with /r on the same line.

Re: Copy file via SCP from NetMRI to a device

Adviser
Posts: 406
6318     0

If you have our IPAM(DDI) product you cause the HTTP/FTP/TFTP server built into it for file transfers

 

Sif

Follow me on LinkedIn: https://www.linkedin.com/in/sifbaksh
Twitter: https://twitter.com/sifbaksh

Re: Copy file via SCP from NetMRI to a device

[ Edited ]
Expert
Posts: 42
6318     0

The device itself doesn't offer any copy or download cli commands. The only way is to upload files via scp manually.

 

 

Re: Copy file via SCP from NetMRI to a device

BGroves
Techie
Posts: 6
6318     0

One word of warning: If you use IPAM as ftp server your backups will be that much larger.

When we first stood up Infoblox for dns/dhcp we used a couple of the grid members as our ftp server and the backups grew to be completely unwieldy. Sure we could back them up to our storage devices but trying to say share a copy with InfoBlox professional services became a huge pain.

We ended up standing up a dedicated ftp/sccp server to hold binaries for our routers, switches and other network devices and wrote a NetMRI script to copy files from this dedicated server to these various devices.

 

Re: Copy file via SCP from NetMRI to a device

Expert
Posts: 42
6318     0

Thank you for all your input. I guess we have no solution for this right. Please correct me if I'm wrong.

Re: Copy file via SCP from NetMRI to a device

Adviser
Posts: 57
6318     0

I believe, (I may be wrong as well Smiley Wink) , there is some confusion on this. I would strongly recommend contacting support. Since, this is a usability query, one WebEx session should be good enough to get some workaround for this.

 

Re: Copy file via SCP from NetMRI to a device

Expert
Posts: 127
6318     0

 

How I get files out of NetMRI to another device (server share) is first have the NetMRI script save the output to a file in the sandbox then I have a crontab job that will scp to the server share.  Note that in order to get around the password prompt you will need to exchange keys.  Below is an example of a script that would perform a show running config on Cisco devices and save to /mnt/host/data/userdata/DeviceConfigs in the sandbox.

 

#!/usr/bin/perl -w
# BEGIN-SCRIPT-BLOCK
#
# Script-Filter: $Vendor == "Cisco"
#
# Script-Login:
# true
#
# Script-Variables:
#
# END-SCRIPT-BLOCK
use strict;
use warnings;
use NetMRI_Easy;

my $easy = new NetMRI_Easy ({ api_version => 2.10 });

my $SetTerm = "";
my $RunCfg = "";

$SetTerm = $easy->send_command("term len 0");
$RunCfg = $easy->send_command("show running-config");

unless(-e "/mnt/host/data/userdata/DeviceConfigs" or mkdir "/mnt/host/data/userdata/DeviceConfigs") {die "Unable to create DeviceConfigs Dir";}

# Write the Config
my $filename = join("", "/mnt/host/data/userdata/DeviceConfigs/", $main::name, ".txt");
open(DATA, ">$filename");
print DATA "$RunCfg";
close DATA;
1;

 

Regards,

Lon.,

Showing results for 
Search instead for 
Do you mean 

Recommended for You