- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
NetMRI Script Output CCS | PERL
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-28-2017 04:31 AM
Hi,
I would like to create a script, CCS or Perl, to analyze the session.log file and verify the banner when the script connects to the device.
For example, I would like to analyze the banner “Nexus 5000 Switch” to create an issue if the banner is “Nexus 6000 Switch”
But can’t I how do that, you can help me ?
Best Regards,
Dam
Solved! Go to Solution.
Re: NetMRI Script Output CCS | PERL
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-28-2017 08:38 AM
I don't know of a way you can do that in CCS. It's probably possible in Perl. But first, I don't follow what you're trying to validate. Within the config of the switch you have a "banner motd" command which creates the banner to be displayed. Instead of trying to validate that within a CLI session, why not create a policy which tests for it in the stored running-config and causes a Policy Violation issue to fire if the banner is not correct?
Re: NetMRI Script Output CCS | PERL
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-28-2017 08:53 AM
If you go to Configuration -> Policy Design Center -> Rules and search on Banner, there are some out of the box sample banner rules that could get you started.
Dave
Re: NetMRI Script Output CCS | PERL
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
04-04-2017 08:13 AM
When you create a CCS sript you have a session.log file. So I would like to scan this file for check the content banner. And no create a policy whith the command banner motd.
Re: NetMRI Script Output CCS | PERL
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
04-10-2017 03:17 PM
Using the API you can do it, this is not my script one of my good buddies
# # Choose a job... # This just chooses the first successfully completed job for a particular date. Anything that # returns a single job will work. # print "Selecting a job...\n"; my @jobs = $netmri->broker->Job->find({ op_EndTime => 'like', val_c_EndTime => '2014-03-19%', op_Status => '=', val_c_Status => 'OK' }); my $job = $jobs[0]; print "\nCollecting all.zip files for job ".$job->JobID."...\n"; my @job_details = $netmri->broker->job_detail->index({ id => $job->JobID }); # # Loop through the device details records for the chosen job. For each device, dump the all.zip file. # foreach my $jd (@job_details){ $devid = $jd->{device}->DeviceID; $ipaddr = $jd->{device}->DeviceIPDotted; $localfilename = $job->JobID."_".$ipaddr."_all.zip"; print "DeviceID=$devid\tIP=$ipaddr\t\tFilename: $localfilename...\n"; open (OUTFILE, ">>$localfilename"); $file = $netmri->broker->job_detail->device_files({ id => $job->JobID, deviceid => $devid, filename => "all.zip" }); print (OUTFILE $file); close (OUTFILE); }
Twitter: https://twitter.com/sifbaksh
https://sifbaksh.com
Re: NetMRI Script Output CCS | PERL
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
08-21-2017 07:59 AM
Thank you Sif !