Infoblox Exchange Cybersecurity Roadshow 2020 – Join us!
North America | Europe | Middle East/Africa | Asia-Pacific

Network Change & Configuration Management

Accepted Solution

NetMRI Script Output CCS | PERL

Posts: 7
3797     1



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,


Re: NetMRI Script Output CCS | PERL

Posts: 232
3797     1

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

Moderator Dave_Signori
Posts: 62
3797     1

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.




Re: NetMRI Script Output CCS | PERL

Posts: 7
3797     1

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

Posts: 412
3797     1

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 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 file.
foreach my $jd (@job_details){
        $devid = $jd->{device}->DeviceID;
        $ipaddr = $jd->{device}->DeviceIPDotted;
        $localfilename = $job->JobID."_".$ipaddr."";
        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 => ""
        print (OUTFILE $file);
        close (OUTFILE);
Follow me on LinkedIn:

Re: NetMRI Script Output CCS | PERL

Posts: 7
3798     1

Thank you Sif !

Showing results for 
Search instead for 
Do you mean 

Recommended for You