add netinfo command

This commit is contained in:
Doug MacEachern 2005-07-11 20:24:43 +00:00
parent 0677fa7fe8
commit dca5d82396
2 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,45 @@
package net.hyperic.sigar.cmd;
import net.hyperic.sigar.SigarException;
/**
* Display network info.
*/
public class NetInfo extends SigarCommandBase {
public NetInfo(Shell shell) {
super(shell);
}
public NetInfo() {
super();
}
public String getUsageShort() {
return "Display network info";
}
public void output(String[] args) throws SigarException {
net.hyperic.sigar.NetInfo info =
this.sigar.getNetInfo();
println("domain................" +
info.getDomain());
println("default gateway......." +
info.getDefaultGateway());
println("primary dns..........." +
info.getPrimaryDns());
println("secondary dns........." +
info.getSecondaryDns());
println("dhcp server..........." +
info.getDhcpServer());
}
public static void main(String[] args) throws Exception {
new NetInfo().processCommand(args);
}
}

View File

@ -70,6 +70,7 @@ public class Shell extends ShellBase {
registerCommandHandler("ps", new Ps(this));
registerCommandHandler("kill", new Kill(this));
registerCommandHandler("netstat", new Netstat(this));
registerCommandHandler("netinfo", new NetInfo(this));
registerCommandHandler("version", new Version(this));
registerCommandHandler("mps", new MultiPs(this));
registerCommandHandler("sysinfo", new SysInfo(this));