06-22-2025 03:43 AM
Hello, everyone.
Is there any way to configure an EEM applet to display a message saying "dont do that" when someone issues the switchport trunk allowed vlan command but not display it if the command is switchport trunk allowed vlan add?
SW1(config)#event manager applet TRUNK
SW1(config-applet)#event cli pattern "switchport trunk allowed vlan" sync yes
SW1(config-applet)#action 1.0 syslog msg "dont do that!"
What I've configured above of course doesn't achieve what I want it to. There are two problems:
1. It always displays the "dont do that message" regardless of whether I issue the switchport trunk allowed vlan command under interface mode, global config mode, enable mode, whenever I type switchport trunk allowed vlan, that syslog message is generated. Is there any way to only have it appear when issued under interface config mode?
2. The message appears regardless of whether I use switchport trunk allowed vlan or switchport trunk allowed vlan add. Is there any way to add an exception for commands with the add keyword, or?
Thank you.
David
Solved! Go to Solution.
06-22-2025 04:15 AM
I will start by use
1-
Sync No
2-
Make message appear when add specific vlan like
....vlan add 100
Try above abd check
Also why you use syslog why not use only " puts "
MHM
06-22-2025 04:20 AM
I think so, there is two possible solution here. You could use regex in the event cli, with a trigger. You check the config-if and exclude your keyword, add. If you wanted to go further here you could apply this at interface level and not global level I believe.
06-22-2025 04:15 AM
I will start by use
1-
Sync No
2-
Make message appear when add specific vlan like
....vlan add 100
Try above abd check
Also why you use syslog why not use only " puts "
MHM
06-22-2025 05:02 AM
@MHM Cisco World wrote:
I will start by use
1-
Sync No
2-
Make message appear when add specific vlan like
....vlan add 100
Try above abd check
Also why you use syslog why not use only " puts "
MHM
Hello.
I've started with EEM today for my ENCOR exam, I haven't covered the puts keyword yet!
David
06-22-2025 04:20 AM
I think so, there is two possible solution here. You could use regex in the event cli, with a trigger. You check the config-if and exclude your keyword, add. If you wanted to go further here you could apply this at interface level and not global level I believe.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide