- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: How to make Telnet Perl Script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-24-2003 06:15 PM
тАО04-24-2003 06:15 PM
How to make Telnet Perl Script
I need a perl script that will telnet to a router/switch specified by hpov alert. Then it will issue `show proc cpu` and save the result in a text file.
Help will be greatly aprreciated.
Thanks,
jonathan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-24-2003 07:10 PM
тАО04-24-2003 07:10 PM
Re: How to make Telnet Perl Script
you can use the Net::Telnet::Cisco package for this purpose. access this site http://nettelnetcisco.sourceforge.net/docs.html to find any reference for Cisco router. attached below is a sample perl script. You can modify this to your needs.
thanks,
Rodel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-24-2003 07:32 PM
тАО04-24-2003 07:32 PM
Re: How to make Telnet Perl Script
not sure of perl script. but an easy solution is to use expect.
expect is used to automate interactive commands.
check out the below link for more details.
http://hpux.connect.org.uk/hppd/hpux/Tcl/expect-5.38/
cheers
-balaji
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-28-2003 10:41 PM
тАО04-28-2003 10:41 PM
Re: How to make Telnet Perl Script
Thanks for the script. I have it running already.
Now i want to attach the result file to a sendmail. How would i do it? i have a script using sendmail working, just need the code for attaching a file.
thanks.
jonathan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-28-2003 10:58 PM
тАО04-28-2003 10:58 PM
Re: How to make Telnet Perl Script
One simple way, will be to include the file into the body itself.
========================================================
dt=`date +%y%m%d-%H%M`
errorlogfile="$LOGPATH/mylog$dt.log"
emailadd1="yd@myworld.mu"
subject="My logfile"
/usr/bin/mailx -s "$subject" $emailadd1 < $errorlogfile
========================================================
If you want it as an attachement, try:
/usr/bin/uuencode $errorlogfile "TheLogfile.log"|mailx -m -s "This is the file you need [subject] on `date`" $emailadd1
Hope this helps!
Yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-28-2003 11:21 PM
тАО04-28-2003 11:21 PM
Re: How to make Telnet Perl Script
the easiest way to make a mail attachment is to use the MIME::Lite module from CPAN.
Have a look here for a short sample, or better consult your already installed POD on your system
http://www.perldoc.com/perl5.8.0/pod/perlfaq9.html#How-do-I-use-MIME-to-make-an-attachment-to-a-mail-message-
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2003 12:23 AM
тАО04-29-2003 12:23 AM
Re: How to make Telnet Perl Script
Will the Mime::Lite replace this code for sending mail?
# Send Mail
$sendmail = "/usr/lib/sendmail -t";
$to = "To: abc@123.com\n";
$from = "From: 123@abc.com\n";
#$reply_to = "Reply-To: 123@abc.com\n";
$subject = "Subject: Mail\n";
$content = "\n";
open(SENDMAIL, "|$sendmail") or die "Cannot opem $sendmail: $!";
print SENDMAIL $to;
print SENDMAIL $from;
#print SENDMAIL $reply_to;
print SENDMAIL $subject;
print SENDMAIL "Content-type: text/plain\n\n";
print SENDMAIL $content;
close(SENDMAIL);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2003 03:42 AM
тАО04-29-2003 03:42 AM
Re: How to make Telnet Perl Script
i'm attaching an example script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2003 04:18 AM
тАО04-29-2003 04:18 AM
Re: How to make Telnet Perl Script
But (as always with Perl) you have several options since a module like MIME::Lite or the MIME::Tools put an extra abstraction layer over the mail transfer, where you may specify your MTA or let the module take what it detcts as default (this makes your Perl code a bit OS and MTA independent, provided you've got the right set of modules installed).
I'd suggest to get the MIME::Tools from CPAN
http://www.perl.com/CPAN/authors/Eryq/
In it's README you will find that they depend on a couple of other modules because they inherit from them which you also may have to install.
As an attachment I uploaded the output from the POD of MIME::Tools that comes with exactly one example in its synopsis that suits your piping to sendmail way.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2003 10:47 PM
тАО04-29-2003 10:47 PM
Re: How to make Telnet Perl Script
how about assigning us some points? I believe I have answered your main query for making a Telnet PERL script.
regards.
Rodel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2003 11:42 PM
тАО04-29-2003 11:42 PM
Re: How to make Telnet Perl Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-04-2003 04:16 PM
тАО05-04-2003 04:16 PM
Re: How to make Telnet Perl Script
just click on the "how to earn points" link and you will find there the procedure to assign points.
thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-05-2003 06:38 AM
тАО05-05-2003 06:38 AM
Re: How to make Telnet Perl Script
-- Rod Hills