Monitoring Interface Status on JunOS Devices

If you’re connected to the JunOS CLI, we don’t see when interfaces go up and down by default. They’re not like IOS where we can enter ‘term mon’ and see every syslog entry.

To enable this functionality, we can configure a custom syslog file can log our interface status there.

In the example below, we’re logging to the file ‘interface-logs’.  We’re looking at all levels and all the facilities.

The interesting part is using a regular expression to match only the lines containing ‘ifOperStatus’.

system {
    syslog {
        file interface-logs {
            any any;
            match ifOperStatus;
        }
    }
}

 

Or if you prefer the set commands:

set system syslog file interface-logs any any
set system syslog file interface-logs match ifOperStatus

 

We can then watch the status of interfaces at the CLI:

[email protected]> monitor start interface-logs

{master:0}
[email protected]>
*** interface-logs ***
Dec 12 00:02:36  SW01 mib2d[1245]: SNMP_TRAP_LINK_DOWN: ifIndex 524, ifAdminStatus up(1), ifOperStatus down(2), ifName ge-0/0/11
Dec 12 00:02:49  SW01 mib2d[1245]: SNMP_TRAP_LINK_UP: ifIndex 524, ifAdminStatus up(1), ifOperStatus up(1), ifName ge-0/0/11
Dec 12 00:02:49  SW01 mib2d[1245]: SNMP_TRAP_LINK_UP: ifIndex 525, ifAdminStatus up(1), ifOperStatus up(1), ifName ge-0/0/11.0

 

 

Leave a Reply