?
Solved

Java SNMP

Posted on 2002-04-30
6
Medium Priority
?
270 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
  • 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 800 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses
Course of the Month14 days, 1 hour left to enroll

809 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