Solved

Java SNMP

Posted on 2002-04-30
6
261 Views
Last Modified: 2012-05-04
Actually my first question is basically part of my 2nd question. And I was wrong about the input. means, in my network elements(switches, routers) ping/echo services are not enabled.
So the part, I need to know is, how to find out the device
type from the snmp query ? Like, is it a router or ATM switch or firewall or SUN Solaris m/c etc.. ???
Is there any common mib ( mib II ??) or mibattribute
do I need to look ?
Is mib-II should be implemented if it is snmp enabled ?

anything will be appreciated.

Ramesh//
0
Comment
Question by:rameshaa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 9

Expert Comment

by:Venci75
ID: 6980921
.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 6980952
Step 1 would require pinging those hosts. If you have access to the services running on all those hosts, you could run the Echo service on port 7, in which case you could use pure Java. Otherwise, you'd have to do a proper ping using ICMP, which would require you to use JNI.

Come back later about step 2!
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 6981642
You could try this sort of thing:

mport java.io.*;
import java.net.*;
class Ping {
public static void main(String[] args) {
BufferedReader in = null;
try {
Runtime r = Runtime.getRuntime();
Process p = r.exec("ping 62.2.78.245");
if (p == null) {
System.out.println("Could not connect");
}
in = new BufferedReader(new InputStreamReader(p
.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
System.out.println(line);
}
in.close();
} catch (IOException io) {
System.err.println(io.toString());
}
}
}
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 86

Accepted Solution

by:
CEHJ earned 200 total points
ID: 6981659
Better indentation:

import java.io.*;
import java.net.*;

class Ping {

  public static void main(String[] args) {
    BufferedReader in = null;
    try {
      Runtime r = Runtime.getRuntime();
      Process p = r.exec("ping 62.2.78.245");
      if (p == null) {
        System.out.println("Could not connect");
      }
      in = new BufferedReader(new InputStreamReader(p.getInputStream()));
      String line;
      while ((line = in.readLine()) != null) {
        System.out.println(line);
      }
      in.close();
    }
    catch (IOException io) {
      System.err.println(io.toString());
    }
  }
}

0
 
LVL 9

Expert Comment

by:Venci75
ID: 7992748
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Answered by: CEHJ
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Venci75
EE Cleanup Volunteer
0
 

Expert Comment

by:SpideyMod
ID: 8048335
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question