Solved

Java SNMP

Posted on 2002-04-30
6
254 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
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 learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now