Blogs

Scripting How-To: Log traffic and interfaces state with CLI Configlet in Junos Space

By Erdem posted 02-22-2016 06:44

  

Overview

Log traffic and interfaces state with Junos Space CLI configlet.

 

Description

This CLI configlet for Junos Space sends the following commands to Juniper devices:

set system syslog file traffic-log any any
set system syslog file traffic-log match "RT_FLOW_SESSION"

and 

set system syslog file interface-monitor any any
set system syslog file interface-monitor match "ifOperStatus"  

 

Example Configuration

Import the CLI configlet xml to Junos Space.

Note: This configlet is written for EX and has no variables. Update the configlet to match your device and configuration needs.

 

Capture.JPG

Configlet XML Contents

 

<?xml version="1.0" encoding="iso-8859-1"?><cli-configlets>
<cli-configlet>
<!-- mandatory --><name>jnet-example</name>
<category>example</category>
<context>/device</context>
<!-- mandatory --><device-family>EX</device-family>
<description>example for jnet forum</description>
<!-- mandatory --><execution-type>Single</execution-type>
<preview-show-parameters>true</preview-show-parameters>
<preview-show-configuration>true</preview-show-configuration>
<postview-show-parameters>true</postview-show-parameters>
<postview-show-configuration>true</postview-show-configuration>

<cli-configlet-pages><!-- At least one configlet page required -->
<cli-configlet-page>
<page-number>1</page-number>
<!-- mandatory --><cli-text> system {
    syslog {
        file traffic-log {
            any any;
            match &quot;RT_FLOW_SESSION&quot;;
        }
        file interface-monitor {
            any any;
            match &quot;ifOperStatus&quot;;
        }
    }
}

</cli-text>
</cli-configlet-page>
</cli-configlet-pages>

<cli-configlet-params>
</cli-configlet-params>

</cli-configlet>  

 


#How-To
#JunosSpace