add netinfo command
This commit is contained in:
parent
0677fa7fe8
commit
dca5d82396
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -70,6 +70,7 @@ public class Shell extends ShellBase {
|
||||||
registerCommandHandler("ps", new Ps(this));
|
registerCommandHandler("ps", new Ps(this));
|
||||||
registerCommandHandler("kill", new Kill(this));
|
registerCommandHandler("kill", new Kill(this));
|
||||||
registerCommandHandler("netstat", new Netstat(this));
|
registerCommandHandler("netstat", new Netstat(this));
|
||||||
|
registerCommandHandler("netinfo", new NetInfo(this));
|
||||||
registerCommandHandler("version", new Version(this));
|
registerCommandHandler("version", new Version(this));
|
||||||
registerCommandHandler("mps", new MultiPs(this));
|
registerCommandHandler("mps", new MultiPs(this));
|
||||||
registerCommandHandler("sysinfo", new SysInfo(this));
|
registerCommandHandler("sysinfo", new SysInfo(this));
|
||||||
|
|
Loading…
Reference in New Issue