Solved

Java SNMP

Posted on 2002-04-30
6
257 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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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

Suggested Solutions

Title # Comments Views Activity
HashTable highest marks enumeration alternative 9 43
servlet example issue 6 46
Is there a simpler dropbox system? 10 34
junit as external jar or library 7 24
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

829 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