Grabbing data from telnet host

M

Mark

I have a script setup to log into a host using the Net::Telnet CPAN
module.
It logs on to this host, sends a username and password and then sends
some commands, prints a message to the screen and then closes the
session.

This is working fine for the purpose but I would like to modify it so
that I can get a status of the host before I send commands to change
the configuration of the host.

I would like to do something like the following: (bear with me my
psuedocode aint that great)

get <system route table>
put output -> $variable
grep $variable "0.0.0.0 0.0.0.0 192.168.1.1" -> $newvariable
if $newvariable = "0.0.0.0 0.0.0.0 192.168.1.1" then
print = "Device online"
else
print = "Device not online"
end if

Any ideas?
 
A

Anno Siegel

Mark said:
I have a script setup to log into a host using the Net::Telnet CPAN
module.
It logs on to this host, sends a username and password and then sends
some commands, prints a message to the screen and then closes the
session.

This is working fine for the purpose but I would like to modify it so
that I can get a status of the host before I send commands to change
the configuration of the host.

I would like to do something like the following: (bear with me my
psuedocode aint that great)

get <system route table>
put output -> $variable
grep $variable "0.0.0.0 0.0.0.0 192.168.1.1" -> $newvariable
if $newvariable = "0.0.0.0 0.0.0.0 192.168.1.1" then
print = "Device online"
else
print = "Device not online"
end if

Any ideas?

Most people use ping for that.

Anno
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top