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