📄 solaris.java
字号:
/* * This file is part of MobiMon. * * MobiMon is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * MobiMon is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with MobiMon; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */package mobimon.mbeans;import java.io.*;import mobimon.common.*;public class Solaris implements SolarisMBean { /* * ------------------------------------------ * PUBLIC METHODS * ------------------------------------------ */ /** Getter for property fileContents. * @return Value of property fileContents. */ public Page getMessages() { return MBeanHelper.getFileContents(logFile, -1); } public byte[] getSwap() { return MBeanHelper.executeCommand("/usr/sbin/swap -s"); } public byte[] getDiag() { return MBeanHelper.executeCommand("/usr/platform/sun4u/sbin/prtdiag -v"); } public byte[] getDiskUsage() { return MBeanHelper.executeCommand("/usr/bin/df -k"); } public byte[] getUptime() { return MBeanHelper.executeCommand("/usr/bin/uptime"); } /** Getter for property testString. * @return Value of property testString. */ public String getTestString() { return testString; } /** Setter for property testString. * @param testString New value of property testString. */ public void setTestString(String testString) { this.testString = testString; } /** Getter for property testGauge. * @return Value of property testGauge. */ public float getTestGauge() { return testGauge; } /** Setter for property testGauge. * @param testGauge New value of property testGauge. */ public void setTestGauge(float testGauge) { this.testGauge = testGauge; } /** Getter for property testCounter. * @return Value of property testCounter. */ public int getTestCounter() { return testCounter; } /** Setter for property testCounter. * @param testCounter New value of property testCounter. */ public void setTestCounter(int testCounter) { this.testCounter = testCounter; } public Page getMessagesPage(int page) { return MBeanHelper.getFileContents(logFile, page); } public Page getSyslog() { return MBeanHelper.getFileContents(syslog, -1); } public Page getSyslogPage(int pageNo) { return MBeanHelper.getFileContents(syslog, pageNo); } public byte[] getWho() { return MBeanHelper.executeCommand("/usr/bin/who"); } public byte[] ping(String hostName) { return MBeanHelper.executeCommand("/usr/sbin/ping " + hostName); } /* * ------------------------------------------ * PRIVATE VARIABLES * ------------------------------------------ */ private final String logFile = "/var/adm/messages"; private String testString = "blah"; private float testGauge = 0.0F; private int testCounter = 0; private final String syslog = "/var/log/syslog"; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -