Schedule a script

  • 0
  • 1
  • Question
  • Updated 5 years ago
  • Answered
Create Date: Nov 26 2012 9:33PM

Is there a way I can schedule a script to disable some ports in the night and re-enable them again. I want to reboot a POE device every night.

di inline-power port X
en inline-power port X

This should do it but I am trying to figure out if we can schedule the scripts without using Ridgeline?

(from Arpit_Bhatt)
Photo of EtherNation User

EtherNation User, Employee

  • 20,340 Points 20k badge 2x thumb

Posted 5 years ago

  • 0
  • 1
Photo of EtherNation User

EtherNation User, Employee

  • 20,340 Points 20k badge 2x thumb
Create Date: Nov 27 2012 10:22PM

Hey Arbhatt

Yes you can do this using two UPM Profiles.  UPM profiles are scripts that are dynamic.  Here's how to do this for the disable power part you would do the same for enable inline power

Create upm profile power_off
disable inline power port X
.
Note that the "." has to be the by itself in the last line

Once the profile is built you create and add a timer

Create upm timer power_off_Timer
config upm timer "power_off_timer" at 11 27 2012 20 00 00 every 86400 (this timer would kick off at 8:00 pm and execute every day. Time is in seconds)

This attaches the timer to the profile

config upm timer "power_off_timer" profile "power_off"

You would do the same thing for the power on just pick a new time.

Hope that helps
P

(from Paul_Russo)
Photo of EtherNation User

EtherNation User, Employee

  • 20,340 Points 20k badge 2x thumb
Create Date: Nov 27 2012 10:51PM

That makes sense. Thanks for the information.

Any idea when you would use UPM scripts over .xsf scripts?
1) If there is no Ridgeline.
Any other scenarios?

In this case I am using Ridgeline and have a script task schedule for port enable/disable.

(from Arpit_Bhatt)
Photo of EtherNation User

EtherNation User, Employee

  • 20,340 Points 20k badge 2x thumb
Create Date: Nov 28 2012 1:46PM

Hello Arbhatt

UPM is used for any "scripting" that needs to happen based on an event.  That event can be time as we did here, it could be based on a device using LLDP (for example a phone connects in and you want to move it to a VLAN and set up ACLs and QoS), it could be a user authentication (set a level of ACL or QoS for a certain user) or it can be based on a log message (if event A is seen i the log then do this.  The this is the UPM profile)

A script is static and is used for doing something needed on the switch.  For example doing a grep for a variable or executing a series of commands to set up a configuration.  Something that does not need to happen on a regular basis. It is possible to use UPM to launch a script.  There is a script for fdboui where the script used the OUI of the MAC address from the FDB table to tell you which manufacturer is on each port.  I have used UPM to launch that script every hour and post the information to the log which in turn gets sent to a syslog server.

Ridgeline is just a central location to manage all of this information from UPM to scripts.  It is the way to deploy a UPM profile to the whole network if needed as an example.

Does that help?

P

(from Paul_Russo)
Photo of EtherNation User

EtherNation User, Employee

  • 20,340 Points 20k badge 2x thumb
Create Date: Nov 29 2012 12:32AM

That's a really good explanation. Thank you so much. I am into static scripting but haven't tried the UPM profiles yet. Now i understand the stuff

We have some switches that are still running 12.3.3.6. So I think I can use ELRP to detect loops and then use the event in the log to disable port. Thanks for the information and help.

(from Arpit_Bhatt)
Photo of EtherNation User

EtherNation User, Employee

  • 20,340 Points 20k badge 2x thumb
Create Date: Dec 4 2012 11:41PM

Hey Arbhatt

if you have 12.5 or later ELRP can do that for you.  If not then yes scripting will help you do disable the port.  I would recommend the new code first as it adds some nice capabilities with a duration versus a permanent disable and the ability to not block uplink or EAPS ports.

good luck

(from Paul_Russo)
Photo of EtherNation User

EtherNation User, Employee

  • 20,340 Points 20k badge 2x thumb
Create Date: Dec 6 2012 3:39AM

Hey Prusso,

Looks like i will have to go for UPM profiles coz Ridgeline did not work v well with scheduling. It does not reboot the devices as expected. Shceduling part of the code for script tasks seems to not work.

Thanks for your help.

Arpit

(from Arpit_Bhatt)