skip to content
Technical documentation
User Tools
Log In
Site Tools
Search
Tools
Show page
Old revisions
Export to PDF
Backlinks
Recent Changes
Media Manager
Sitemap
Log In
>
Recent Changes
Media Manager
Sitemap
Trace:
guides:user:scenarios:parse_ping
{{indexmenu_n>2}} ====== Parsing ping test ====== The goal of this example is to use a ping test and use its result as a condition. Vendor: Cisco_IOS ===== Command Job ===== The job is "empty". It still requires something though, so it's filled with a '!'. <code> ! </code> ===== Parsing template ping_cisco_ios ===== The command that is used is //ping <ip>//. The output is shown below: <code> Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 20.20.20.6, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 5/9/17 ms </code> This parse template will match specifically on the words "Success rate is" and "percent", the variable is set which is in between, in this case the digit "100". The remainder of the line is ignored by using "|*|" <code> Success rate is <percent> percent |*| </code> ===== Job scenario ===== <code> Description Parsing vlan and interfaces on <node> task = ping_test </code> ===== Scenario ping_test ===== <code> # Test whether node is live and reachable reachable -n <node> if error LogAction -n <node> -a Parse_job -m "<node> is not reachable" stop endif LogAction -n <node> -a Parse_job -m "<node> is reachable" <@cmd> = parse_cmd -n <node> -t ping_cisco_ios -r "ping <ip>" if ! <percent> == 0 log -m "ping is successful" # choose your action endif end </code>
guides/user/scenarios/parse_ping.txt
· Last modified: 2024/07/03 12:31 by
127.0.0.1
Page Tools
Show page
Old revisions
Backlinks
Export to PDF
Back to top