473,473 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

is there a perl mechanism to ping a network element before issuing SNMP commands?

12 New Member
Since I found the site by googling, I will post a new question in addition to my follow-on response, with belief it will aid others. And increased crossing of fingers it will aid in receiving a response.

Cutting to the chase.....

i can use a system call to issue a ping to network element easily enough

Ie, system("/directory1/directory2/command like i was in CLI");

how can i harvest the response from the remote element to logically decide the next move?

am i on the right track in thinking you can use the if or else logic with a command line response?


Hutch
Mar 14 '08 #1
4 1755
numberwhun
3,509 Recognized Expert Moderator Specialist
Since I found the site by googling, I will post a new question in addition to my follow-on response, with belief it will aid others. And increased crossing of fingers it will aid in receiving a response.

Cutting to the chase.....

i can use a system call to issue a ping to network element easily enough

Ie, system("/directory1/directory2/command like i was in CLI");

how can i harvest the response from the remote element to logically decide the next move?

am i on the right track in thinking you can use the if or else logic with a command line response?


Hutch
Have you searched CPAN to see what modules are available? You may find one that will work for you.

Regards,

Jeff
Mar 14 '08 #2
hutch75
12 New Member
Thanks Mate, I was trying to steer clear of any modules. The SA won't allow any use of XYZ beyond basic perl functionality. Don't ask my=[me]-edit why. I'm just wearing the development hat as a one-off here.

Just looking for basic perl functionality to do the task at hand.

Cheers,

Hutch
Mar 14 '08 #3
numberwhun
3,509 Recognized Expert Moderator Specialist
Thanks Mate, I was trying to steer clear of any modules. The SA won't allow any use of XYZ beyond basic perl functionality. Don't ask my=[me]-edit why. I'm just wearing the development hat as a one-off here.

Just looking for basic perl functionality to do the task at hand.

Cheers,

Hutch
Well then, you have only a couple of choices.

First, you could just use the system function to ping the remote host:

Expand|Select|Wrap|Line Numbers
  1.  
  2. system("pint remote_host");
  3.  
or, you could download the a module that can do what you are looking for and copy the code out of it directly and use it that way (that way you don't have to install the module).

Choice is yours.

Regards,

Jeff
Mar 14 '08 #4
seltzerb
2 New Member
How about:

Expand|Select|Wrap|Line Numbers
  1. use Net::Ping;
  2. $host="myServer";
  3. $p = Net::Ping->new();
  4. if($p->ping($host)){
  5.   print "$host is alive.\n";
  6. }else{
  7.   print "$host is down.\n";
  8. }
  9. $p->close();
Mar 14 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: Alexandre Plennevaux | last post by:
hello ! I would like to measure the time a user needs to connect to my website. In other words, to perform a ping between my website and the user's computer. I'm scratching my head as to how...
0
by: Danny Jensen | last post by:
I need to test if certain processes on a unix box were running. I wanted to use whatsup gold to do the testing. First I needed to go to the whatsup configure>monitors & services menu to add this...
3
by: bernd wegener | last post by:
Hello netties, I coded the following in perl: open(LOGFILE,">&STDOUT") ; if ( $ARGV ) { close(LOGFILE) ; open(LOGFILE,">> $ARGV") or die "Cannot open file $ARGV\n" ;
17
by: wana | last post by:
I was reading through original source code of ping for some insight and was confused by unusual code. Entire listing available at: http://www.ping127001.com/pingpage/ping.html #include...
2
by: Tim C | last post by:
Is there a way to do a Ping from C# if you are not logged in as administrator on W2k? I am trying to do a Ping from C# running under ASP.NET. I have found several examples on the web, mostly...
3
by: cj | last post by:
I tried "www.microsoft.com and it came back False. Google is True. Are sites able to specify not to reply to ping commands? Could that be why Microsoft retursn False? I need to find a site to...
1
by: Dirk Van de moortel | last post by:
{ OOPS, posted this to moderated group perl.cpan.discuss as well, so it can take a while to get through, if it gets through at all Otherwise sorry for duplicate posting } We need to set up a...
2
by: Manish Roy | last post by:
Hi, I am trying to discover Devices in network . i have a Rang of IPs. I need to know what are the possible steps to Discover Devices with this IPs I am using Perl Script. Most of the Devices...
7
by: moon1 | last post by:
how will I change the code the 1st code according to the 2nd one? 1st code sub snmpGet(@) { # Assign arguments my ($deviceName)=$_; # Device name to read from my...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.