{{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 '!'.
!
===== Parsing template ping_cisco_ios =====
The command that is used is //ping //.
The output is shown below:
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
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 "|*|"
Success rate is percent |*|
===== Job scenario =====
Description Parsing vlan and interfaces on
task = ping_test
===== Scenario ping_test =====
# Test whether node is live and reachable
reachable -n
if error
LogAction -n -a Parse_job -m " is not reachable"
stop
endif
LogAction -n -a Parse_job -m " is reachable"
<@cmd> = parse_cmd -n -t ping_cisco_ios -r "ping "
if ! == 0
log -m "ping is successful"
# choose your action
endif
end