?????????Linux?????????С????
???????????? ???????[ 2014/7/18 14:26:40 ] ????????linux ??????
????????
????1 LinuxService
package com.sunfan.monitor.service;
import java.io.IOException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.sunfan.monitor.manager.pool.LinuxConnectionPool;
import com.sunfan.monitor.platform.IConnectable;
import com.sunfan.monitor.platform.linux.LinuxSessionHandle;
/**
*
* @author sunfan
*
*/
@Component
public class LinuxService {
private String defaultTopComand = "top -b -n 1";
private String defaultMpstatComand = "mpstat -P ALL";
private String defaultFreeCommand = "free -m";
private String defaultIostatCommand = "iostat -d -m";
@Autowired
private LinuxConnectionPool pool ;
@Autowired
private LinuxSessionHandle handle;
/**
* execute default command "top -b -n 1" and return String type reslut
*
* @param url server's ip
* @param user login name
* @param password login password
* @return
* @throws IOException
*/
public String topMonitor(String url??String user??String password) throws IOException{
return this.executeCommand(url?? user?? password?? defaultTopComand);
}
/**
* execute default command "mpstat -P ALL" to get cpus performance
*
* @param url
* @param user
* @param password
* @return
* @throws IOException
*/
public String cpuMonitor(String url??String user??String password) throws IOException{
return this.executeCommand(url?? user?? password?? defaultMpstatComand);
}
/**
* execute default command "free -m" to get memory performance
* @param url
* @param user
* @param password
* @return
* @throws IOException
*/
public String memoryMonitor(String url??String user??String password) throws IOException{
return this.executeCommand(url?? user?? password?? defaultFreeCommand);
}
/**
* execute default command "free -m" to get memory performance
* @param url
* @param user
* @param password
* @return
* @throws IOException
*/
public String inputOutputMonitor(String url??String user??String password) throws IOException{
return this.executeCommand(url?? user?? password?? defaultIostatCommand);
}
public String executeCommand(String url??String user??String password??String command) throws IOException{
IConnectable lc = pool.borrowObject(url??user??password);
return handle.executeCommand(lc.getConnection()??command);
}
}
|
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
Linux??????DDR????????????Linux?????????????????豸??????????linux???в???????????м??????????????????????????Linux????Linux??DNS????????????γ???????????Linux?????????????Linux????(???)????????Linux ????????????????????????????????Windows???У?Linux???????Linux????????????????Linux iommu??vfio???????Linux????ε???TCP???????Linux?????????????СLinux?·???????????Linux???Jexus?й?Asp.Net Core??ó???Linux?????????Щ??
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????