On Wed, Nov 24, 2010 at 1:19 AM, Joe Pepersack <[email protected]> wrote:

>
>
> Why not just call the ssh client and run a command on the remote host?
> I'd set up a passwordless key to a restricted account for security, but
> I'm paranoid.
>
> open LOG, '>>', '/path/to/logfile' or die "Can't open log file\n";
>
> foreach my $target ( qw[ u...@host1 u...@host2 u...@localhost ] ) {
> my $uptime = `/usr/bin/ssh -i /path/to/private_key $target uptime`;
> my $now = localtime;
>
> if ( defined($uptime) ) {
> print LOG "$now\tSSH is up on $target\n";
> }
> else {
> print LOG "$now\tSSH is down on $target\n";
>
> }
> }
>
> On 11/23/2010 11:43 AM, Amit Saxena wrote:
> >
> > On Tue, Nov 23, 2010 at 10:09 PM, shawn wilson 
> > <[email protected]<ag4ve.us%40gmail.com>
> > <mailto:ag4ve.us%40gmail.com <ag4ve.us%2540gmail.com>>> wrote:
> >
> > > Well, each new ssh connection should spawn a new process so you
> > could look
> > > at it from that end. More technically, you could look into netstat
> > or lsof
> > > modules.
> > > On Nov 23, 2010 11:31 AM, "Amit Saxena" 
> > > <[email protected]<learn.tech123%40gmail.com>
> > <mailto:learn.tech123%40gmail.com <learn.tech123%2540gmail.com>>> wrote:
> > > > Hi all,
> > > >
> > > > What's the best way to monitor ssh connectivity, and not just ssh
> port
> > > > availability, to a server using perl assuming following constraints ?
> > > >
> > > > I tried for Net::SSH but public private key is not allowed.
> > > >
> > > > I tried for Net::SSH::Perl etc but these are not built in perl
> > > distribution
> > > > (active perl on windows or part of perl distribution of linux /
> > solaris).
> > > >
> > > > Can we do it via "IO::Socket::INET" ?
> > > >
> > > > Thanks & Regards,
> > > > Amit Saxena
> > >
> >
> > Thanks Shawn for the reply.
> >
> > Actually my requirement, to be specific, is as follows.
> >
> > The script will be executed in periodic fashion from a *nix server and
> the
> > script will initiate a ssh connection to itself using perl. This is to
> > confirm that the ssh service is running and there is no issue in getting
> a
> > new and authenticated ssh session when clients will connect to the server
> > via ssh externally.
> >
> > Please suggest.
> >
> > Thanks & Regards,
> > Amit Saxena
> >
> > [Non-text portions of this message have been removed]
> >
> >
>
> [Non-text portions of this message have been removed]
>
>  __._,_.___
>   Reply to 
> sender<[email protected]?subject=re%3a%20%5bpbml%5d%20re%3a%20monitoring%20ssh%20connectivity%20to%20a%20server%20using%20perl%20%21>|
>  Reply
> to 
> group<[email protected]?subject=re%3a%20%5bpbml%5d%20re%3a%20monitoring%20ssh%20connectivity%20to%20a%20server%20using%20perl%20%21>|
>  Reply
> via web 
> post<http://groups.yahoo.com/group/perl-beginner/post;_ylc=X3oDMTJxdXFrZ3M2BF9TAzk3MzU5NzE0BGdycElkAzEyMjM4NTcEZ3Jwc3BJZAMxNzA1MDA2OTUxBG1zZ0lkAzI3MDU5BHNlYwNmdHIEc2xrA3JwbHkEc3RpbWUDMTI5MDU0NDI0MA--?act=reply&messageNum=27059>|
>  Start
> a New 
> Topic<http://groups.yahoo.com/group/perl-beginner/post;_ylc=X3oDMTJlZXNka2FjBF9TAzk3MzU5NzE0BGdycElkAzEyMjM4NTcEZ3Jwc3BJZAMxNzA1MDA2OTUxBHNlYwNmdHIEc2xrA250cGMEc3RpbWUDMTI5MDU0NDI0MA-->
> Messages in this 
> topic<http://groups.yahoo.com/group/perl-beginner/message/27057;_ylc=X3oDMTM2amt1MmljBF9TAzk3MzU5NzE0BGdycElkAzEyMjM4NTcEZ3Jwc3BJZAMxNzA1MDA2OTUxBG1zZ0lkAzI3MDU5BHNlYwNmdHIEc2xrA3Z0cGMEc3RpbWUDMTI5MDU0NDI0MAR0cGNJZAMyNzA1Nw-->(
> 3)
>  Recent Activity:
>
>    - New 
> Members<http://groups.yahoo.com/group/perl-beginner/members;_ylc=X3oDMTJmbjFsMnFsBF9TAzk3MzU5NzE0BGdycElkAzEyMjM4NTcEZ3Jwc3BJZAMxNzA1MDA2OTUxBHNlYwN2dGwEc2xrA3ZtYnJzBHN0aW1lAzEyOTA1NDQyNDA-?o=6>
>    2
>
>  Visit Your 
> Group<http://groups.yahoo.com/group/perl-beginner;_ylc=X3oDMTJlNW5yNHI4BF9TAzk3MzU5NzE0BGdycElkAzEyMjM4NTcEZ3Jwc3BJZAMxNzA1MDA2OTUxBHNlYwN2dGwEc2xrA3ZnaHAEc3RpbWUDMTI5MDU0NDI0MA-->
>  Unsubscribing info is here:
> http://help.yahoo.com/help/us/groups/groups-32.html
>  [image: Yahoo! 
> Groups]<http://groups.yahoo.com/;_ylc=X3oDMTJkNnE2NTBwBF9TAzk3MzU5NzE0BGdycElkAzEyMjM4NTcEZ3Jwc3BJZAMxNzA1MDA2OTUxBHNlYwNmdHIEc2xrA2dmcARzdGltZQMxMjkwNTQ0MjQw>
> Switch to: 
> Text-Only<[email protected]?subject=change+delivery+format:+Traditional>,
> Daily 
> Digest<[email protected]?subject=email+delivery:+Digest>•
> Unsubscribe<[email protected]?subject=unsubscribe>• 
> Terms
> of Use <http://docs.yahoo.com/info/terms/>
>    .
>
> __,_._,___
>

Hi Joe,

I feel, I have to settle for this option in the end. However is there a way
to NOT to use public-private key with ssh and have embedded password in the
ssh command itself to have non interactive output ?

Thanks & Regards,
Amit Saxena

Reply via email to