cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1939
Views
0
Helpful
0
Replies

Include port description in output

CiscoBill101
Level 1
Level 1

Hi,

I have the following script which emails the results of any interface not containing a certian command.  I'm trying to include the port description in the output but cannot figure out how :

event manager applet test

event none maxrun 900

action 001  cli command "enable"

action 002  cli command "show int status"

action 003  set output "$_cli_result"

action 004  set intfs ""

action 005  foreach line "$output" "\n"

action 006   string trim $line

action 007   set line $_string_result

action 008   string length $line

action 009   if $_string_result eq 0

action 010    continue

action 011   end

action 012   regexp "^Interface" "$line"

action 013   if $_regexp_result eq "1"

action 014    continue

action 015   end

action 016   regexp "#" "$line"

action 017   if $_regexp_result eq "1"

action 018    continue

action 019   end

action 020   regexp "^([^[:space:]]+)[[:space:]]" "$line" match intf

action 021   cli command "show run interface $intf"

action 022   regexp "authentication port-control auto" "$_cli_result"

action 023   if $_regexp_result eq "0"

action 024    append intfs "\n $intf"

action 025   end

action 026  end

action 027  info type routername

action 028  string length "$intfs"

action 029  if $_string_result gt "0"

action 030   mail from "

Test@audit.com

" to "

Cisco@test.com

" server "1.1.1.1" subject "Audit $_info_routername" body "The following interfaces are not enabled for 802.1x': $intfs"

action 031  end

Thanks

0 Replies 0
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: