LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 06-16-2008, 12:35 PM   #1
vortmax
Member
 
Registered: Nov 2005
Posts: 91

Rep: Reputation: 17
socket connection. Ideas wanted


I need to be able to run a script on a remote server and have it return information back to me via a network socket connection.

I manage cable modem networks for apartment complexes where the complex's network sits behind a NAT firewall router that is onsite. To monitor individual modems, I need to be able to query them with SNMP. Since I am on the outside of the NAT, this is virtually impossible. I have a provisioning server on the inside of the network that is on the modem's network. Right now I can monitor the modems by connecting to the box via ssh and running several scripts that perform the snmpget's and format the returned data. I need to extend this so that a script located at the main office (outside the network) can perform this task.

All the script will have to do is open the socket to the remote server, pass two parameters (data type and IP to query), and wait for the response. No private information is going to pass over this connection, but a secure connection would still be a plus.

Do I need to look at programming a socket based client-server program from scratch or can SSH be coaxed into this type of duty. Both servers are running linux, so I know I can use shared key authentication.
 
Old 06-16-2008, 07:16 PM   #2
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
Welel, you could (as you say) use auth keys to connect to the apartment server.
Write a server eg using Perl to recv your request (on the apartment server), do the snmp query and rtn the results to you/local server.
Sounds like you don't need forking or threads, unless you want lots of real-time monitoring.
See http://perldoc.perl.org/
Also, for worked examples, start here and read down the page : http://perldoc.perl.org/perlipc.html...IO%3a%3aSocket
includes clients and servers using the IO::Socket module that handles all the fiddly bits for you

Edit: actually, that would be a plain text cxn, which for your purposes might be ok. If not, put the relevant cmds in a file on the apartment server and call it using http://search.cpan.org/~ivan/Net-SSH-0.09/SSH.pm
OR
http://search.cpan.org/~dbrobins/Net...et/SSH/Perl.pm

See also http://search.cpan.org/~bnegrao/Net-...SSH/Expect.pod which is prob what you want.
As always, TMTOWTDI

Last edited by chrism01; 06-16-2008 at 07:38 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Network monitoring Ideas wanted here2serve Linux - Enterprise 2 03-27-2008 07:47 PM
LXer: Google Summer of Code 2007 - mentors and project ideas wanted LXer Syndicated Linux News 0 03-10-2007 12:01 AM
connection between java socket and unix socket sathishkumar Programming 1 01-10-2006 04:21 PM
ideas wanted please frieza General 3 02-11-2005 10:37 PM
WANTED: Your ideas for Rescue Linux scuzzman Linux - General 2 12-27-2004 05:19 AM


All times are GMT -5. The time now is 08:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration