cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
715
Views
10
Helpful
6
Replies

Shutdown a port at specific time in Nexus Switch 9k

jair6a
Level 1
Level 1

I have searching something useful to do this, but I haven´t funded something useful. I wanted to use "event timer feature" (with EEM) like IOS but seems like it does not exist in NXOS versions. Could you help me with some ideas?

 

Version 10.1(1) Nexus

93108TC-EX

 

Thank you!

 

1 Accepted Solution

Accepted Solutions

I tried this, but it didn't run. Sorry it's not much help, but it might just point you in the right direction:

 

event manager applet SHUTPORTs
action 0001 cli command "enable"
action 0002 cli command "configure terminal"
action 0003 cli command "interface Eth1/10"
action 0004 cli command "descr EEM-Script" <- change to shutdown
action 0005 cli command "end"
action 0006 syslog msg SHUTPORTs EEM has executed
exit
!
feature scheduler
scheduler job name JOB-SHUTPORTs
 event manager run SHUTPORTs
exit
scheduler schedule name SCH-SHUTPORTs
 job name JOB-SHUTPORTs
 time start 2022:09:13:22:00
exit

show scheduler schedule

 


View solution in original post

6 Replies 6

Sergiu.Daniluk
VIP Alumni
VIP Alumni

Hi @jair6a 

I see the option to use timer with EEM available for both N7k and N9K:

 event timer {absolute time time name name | countdown time time name name | cron cronentry string | tag tag | watchdog time time name name} 

If the feature is missing you probably need to upgrade your NXOS version.

Here is the config guide:

https://www.cisco.com/c/en/us/td/docs/switches/datacenter/nexus9000/sw/93x/system-management/b-cisco-nexus-9000-series-nx-os-system-management-configuration-guide-93x/b-cisco-nexus-9000-series-nx-os-system-management-configuration-guide-93x_chapter_0...

 

Take care,

Sergiu

Thank you for your reply. In fact, I found the configuration guide for the specific version (10.1):

Cisco Nexus 9000 Series NX-OS System Management Configuration Guide, Release 10.1(x) - Configuring the Embedded Event Manager [Cisco Nexus 9000 Series Switches] - Cisco

and I saw the option in the guide as you mentioned before, but in the cli of my switches it isn´t.

N9k(config)#
N9k(config)#
N9k(config)# event manager applet SHUTPORTs
N9k(config-applet)#
N9k(config-applet)#
N9k(config-applet)#
N9k(config-applet)# event timer ?
^
% Invalid command at '^' marker.
N9k(config-applet)# event timer
^
% Invalid command at '^' marker.
N9k(config-applet)#
N9k(config-applet)#
N9k(config-applet)# event ?
cli Create a cli event specification
counter Create a counter event
fanabsent Create fanabsent event specification
fanbad Create fanbad event specification
fib FIB related event
memory Create memory thresholds event specification
module Create a 'module' event specification
module-failure Create a 'module-failure' event specification
oir Create Online-Insertion-Removal event specification
policy-default Use the event in the system policy being overridden
poweroverbudget Create poweroverbudget event specification
snmp Create a 'snmp' event specification.
snmp-notification Create a 'snmp-notification' event specification.
storm-control Create a storm control event specification
syslog Create a syslog event specification
sysmgr System manager related events
temperature Create temperature event specification
test Create a 'test' event specification
track Create a 'track' event specification

N9k(config-applet)# event
^
% Incomplete command at '^' marker.
N9k(config-applet)#

 

 

j.a.m.e.s
Level 3
Level 3

Could you write it as a Python script and use the nx-os scheduler?

An example is shown at the end of this page:

NX-OS Programmability Guide 

I tried this, but it didn't run. Sorry it's not much help, but it might just point you in the right direction:

 

event manager applet SHUTPORTs
action 0001 cli command "enable"
action 0002 cli command "configure terminal"
action 0003 cli command "interface Eth1/10"
action 0004 cli command "descr EEM-Script" <- change to shutdown
action 0005 cli command "end"
action 0006 syslog msg SHUTPORTs EEM has executed
exit
!
feature scheduler
scheduler job name JOB-SHUTPORTs
 event manager run SHUTPORTs
exit
scheduler schedule name SCH-SHUTPORTs
 job name JOB-SHUTPORTs
 time start 2022:09:13:22:00
exit

show scheduler schedule

 


You´re right. I tried with scheduler feature and it´s so easy!

I tried next:

scheduler job name SHUTPORT
configure
interface loopback0
shutdown

end-job

scheduler schedule name WEEKENDs
job name SHUTPORT
time start 2022:09:13:18:26 repeat 0:24:0

And the result was the following:

N9k# show clock
Time source is NTP
18:24:33.693 UTC Tue Sep 13 2022
N9k#
N9k#
N9k#
N9k# show ip int br
IP Interface Status for VRF "default"(1)
Interface IP Address Interface Status
Lo0 55.55.55.55 protocol-up/link-up/admin-up
Eth2/1 192.168.1.2 protocol-up/link-up/admin-up
N9k#
N9k# show clock
Time source is NTP
18:26:32.804 UTC Tue Sep 13 2022
N9k#
N9k#
N9k#
N9k# show clock
Time source is NTP
18:27:14.614 UTC Tue Sep 13 2022
N9k#
N9k# show clock
Time source is NTP
18:27:16.583 UTC Tue Sep 13 2022
N9k#
N9k#
N9k# show ip int br
IP Interface Status for VRF "default"(1)
Interface IP Address Interface Status
Lo0 55.55.55.55 protocol-down/link-down/admin-down
Eth2/1 192.168.1.2 protocol-up/link-up/admin-up
N9k#
N9k#
N9k#

Thank you for your help!

 

Thanks for posting back. Good to see that all the config can be handled directly under the scheduler job section without needing the EEM applet.