Skip to content

Instantly share code, notes, and snippets.

@matsubo
Created June 7, 2020 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matsubo/f77b80162ec4ee9f5c07a711c974d78c to your computer and use it in GitHub Desktop.
Save matsubo/f77b80162ec4ee9f5c07a711c974d78c to your computer and use it in GitHub Desktop.
Get current stat via telnet on RTX830
#!/bin/bash
HOST=$1
COMMAND="show arp"
$(dirname $0)/rtx_command.sh $HOST "${COMMAND}" | grep "Count" | awk '{print $2}'
#!/bin/bash
HOST=$1
COMMAND="show arp"
$(dirname $0)/rtx_command.sh $HOST "${COMMAND}"| grep "Count" | awk '{print $2}'
#!/bin/bash
HOST=$1
COMMAND="show nat descriptor masquerade session summary"
$(dirname $0)/rtx_command.sh $HOST "${COMMAND}" | grep 'PP' | awk '{ print $4}' | awk -F '/' '{print $1}'
#!/usr/bin/expect
# ./rtx_command.sh <host> <command>
# replace `YOURPASSWORD`
spawn telnet [lindex $argv 0]
expect "Password:"
send "YOURPASSWORD\r"
expect ">"
send "[lindex $argv 1]\r"
expect ">"
send "exit\r"
close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment