Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: grep ip address from dhcpd.leases file using mac address

by mmenza (Initiate)
on Jan 11, 2014 at 11:47 UTC ( [id://1070252]=note: print w/replies, xml ) Need Help??


in reply to grep ip address from dhcpd.leases file using mac address

I think that you need to check two things:

1) Is your ssh connection working? perhaps you can put the command '@ar=$ssh->cmd("hostname")` in your script (instead of the existing @ar= command) and see if you get any print output.

2) Does the ssh login username and password, and the cd and cat commands (sent via $ssh->cmd) work if done manually?

I might do this another way (using @ar = `ssh user@hostname 'cat /var/lib/dhcp | grep $ARGV[0]'` and having ssh keys in place to avoid needing a password, as per the man ssh keygen and google).

Your way could/should work, might just need to troubleshoot a bit.
  • Comment on Re: grep ip address from dhcpd.leases file using mac address

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1070252]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2024-04-24 07:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found