//
// /**
// * 获取数据
// */
// public static List
// List
// if(!“Linux”.equals(OSinfo.getOSname())){
// final CountDownLatch latch = new CountDownLatch(5);
// threadPoolTaskExecutor.submit(new Runnable() {
// @Override
// public void run() {
// TestGetData.getJVM();
// latch.countDown();
// }
// });
// threadPoolTaskExecutor.submit(new Runnable() {
// @Override
// public void run() {
// Map linux = TestGetData.getOpenFiles(“192.168.134.100”, “root”, “root”, 22, “ulimit -a”);
// list.add(linux);
// latch.countDown();
// }
// });
// threadPoolTaskExecutor.submit(new Runnable() {
// @Override
// public void run() {
// Map mysql = TestGetData.getMysql(“192.168.134.100”, “root”, “root”, 22, “cat /etc/my.cnf”);
// list.add(mysql);
// latch.countDown();
// }
// });
// threadPoolTaskExecutor.submit(new Runnable() {
// @Override
// public void run() {
// Map redis = TestGetData.getRedis(“192.168.134.100”, “root”, “root”, 22, “cat redis.conf”, “/usr/local/redis/bin/redis-cli info clients”);
// list.add(redis);
// latch.countDown();
// }
// });
// threadPoolTaskExecutor.submit(new Runnable() {
// @Override
// public void run() {
Map tomcat = TestGetData.getXml(“G:\Tomcat\PersonalTomcat\OrdinaryTomcat\apache-tomcat-9.0.27\conf\server.xml”);
list.add(tomcat);
// latch.countDown();
// }
// });
// }
// return list;
// }
//
//
//
// /**
// * 远程 执行命令并返回结果调用过程 是同步的(执行完23才会返回)
// * @param host 主机名
// * @param user 用户名
// * @param psw 密码
// * @param port 端口
// * @param command 命令
// * @return
// */
// public static Map exec(String host,String user,String psw,int port,String command){
// String result=“”;
// Session session =null;
// ChannelExec openChannel =null;
// Map<String, String> map = new HashMap<>();
// try {
// JSch jsch=new JSch();
// session = jsch.getSession(user, host, port);
// java.util.Properties config = new java.util.Properties();
// config.put(“StrictHostKeyChecking”, “no”);
// session.setConfig(config);
// session.setPassword(psw);
// session.connect();
// openChannel = (ChannelExec) session.openChannel(“exec”);
// openChannel.setCommand(command);
// openChannel.connect();
// InputStream in = openChannel.getInputStream();
// BufferedReader reader = new BufferedReader(new InputStreamReader(in));
// String buf = null;
// while ((buf = reader.readLine()) != null) {
// String data = new String(buf.getBytes(“UTF-8”),“UTF-8”);
// result+= data +“\r\n”;
// if(buf.contains(“open files”)){
// map.put(“openFiles”,data);
// }
// if(buf.contains(“soft nofile”)){
// map.put(“softNofile”,data);
// }
// if(buf.contains(“hard nofile”)){
// map.put(“hardNofile”,data);
// }
// if(buf.contains(“max_connections”)){
// map.put(“maxConnections”,data);
// }
// if(buf.contains(“innodb_buffer_pool_size”)){
// map.put(“innodbBufferPoolSize”,data);
// }
// if(buf.contains(“timeout”)){
// map.put(“timeout”,data);
// }
// if(buf.contains(“connected_clients”)){
// map.put(“connectedClients”,data);
// }
// }
// } catch (JSchException | IOException e) {
// result+=e.getMessage();
// }finally{
// if(openChannel!=null&&!openChannel.isClosed()){
// openChannel.disconnect();
// }
// if(session!=null&&session.isConnected()){
// session.disconnect();
// }
// }
// map.put(“all”,result);
// return map;
// }
//
// public static void getJVM(){
// MemoryMXBean memorymbean = ManagementFactory.getMemoryMXBean();
// System.out.println("堆内存信息: " + memorymbean.getHeapMemoryUsage());
// System.out.println("方法区内存信息: " + memorymbean.getNonHeapMemoryUsage());
//
// List inputArgs = ManagementFactory.getRuntimeMXBean().getInputArguments();
// System.out.println(“\n#####################运行时设置的JVM参数#######################”);
// System.out.println(inputArgs);
//
// System.out.println(“\n#####################运行时内存情况#######################”);
// long totle = Runtime.getRuntime().totalMemory();
// System.out.println(“总的内存量 [” + totle + “]”);
// long free = Runtime.getRuntime().freeMemory();
// System.out.println(“空闲的内存量 [” + free + “]”);
// long max = Runtime.getRuntime().maxMemory();
// System.out.println(“最大的内存量 [” + max + “]”);
// }
//
//
//
// public static Map getRedis(String host,String user,String psw,int port,String conf,String info){
// Map map = exec(host, user, psw, port, conf);//“cat redis.conf”
// Map<String, String> hashMap = new HashMap<>();
// if(!CollectionUtils.isEmpty(map)){
// String timeoutStr = (String) map.get(“timeout”);
// if(!StringUtils.isEmpty(timeoutStr)){
// hashMap.put("timeout ",timeoutStr);
// }else {
// hashMap.put("timeout ",“0”);
// }
// }
// Map clients = exec(host, user, psw, port, info);//“/usr/local/redis/bin/redis-cli info clients”
// String connectedClients = getInt(((String)clients.get(“connectedClients”)));
// hashMap.put(“connectedClients”,connectedClients);
// return hashMap;
// }
//
// /**
// * 获取mysql参数
// * @return
// */
// public static Map getMysql(String host,String user,String psw,int port,String command){
// Map map = exec(host, user, psw, port, command);//“cat /etc/my.cnf”
// Map<String, String> hashMap = new HashMap<>();
// if(!CollectionUtils.isEmpty(map)){
// String maxConnections = getInt(((String)map.get(“maxConnections”)));
// if(StringUtils.isEmpty(maxConnections)){
// maxConnections = “0”;
// hashMap.put(“maxConnections”,maxConnections);
// }
// String innodbBufferPoolSize = getInt((String)map.get(“innodbBufferPoolSize”));
// if(StringUtils.isEmpty(innodbBufferPoolSize)){
// innodbBufferPoolSize = “0”;
// hashMap.put(“innodbBufferPoolSize”,innodbBufferPoolSize);
// }
// }
// return hashMap;
// }
//
// /**
// * 获取打开的最大文件数
// * @return
// */
// public static Map getOpenFiles(String host,String user,String psw,int port,String ulimit){
// Map<String, String> hashMap = new HashMap<>();
// Map map = exec(host, user, psw, port, ulimit);//ulimit -a
// String openFiles = (String) map.get(“openFiles”);
// hashMap.put(“openFiles”,openFiles);
// return hashMap;
// }
//
// /**
// * 获取nofile
// * @param host
// * @param user
// * @param psw
// * @param port
// * @param noFile
// * @return
// */
// public static Map getNofile(String host,String user,String psw,int port,String noFile){
// Map<String, String> hashMap = new HashMap<>();
// Map exec = exec(host, user, psw, port, noFile);//“cat /etc/security/limits.conf”
// String hardNofile = getInt((String)exec.get(“hardNofile”));
// hashMap.put(“hardNofile”,hardNofile);
// String softNofile = getInt((String)exec.get(“softNofile”));
// hashMap.put(“softNofile”,softNofile);
// return hashMap;
// }
//
// /**
// * 获取数字
最后的话
最近很多小伙伴找我要Linux学习资料,于是我翻箱倒柜,整理了一些优质资源,涵盖视频、电子书、PPT等共享给大家!
资料预览
给大家整理的视频资料:
给大家整理的电子书资料:
如果本文对你有帮助,欢迎点赞、收藏、转发给朋友,让我有持续创作的动力!
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
优质资源,涵盖视频、电子书、PPT等共享给大家!
资料预览
给大家整理的视频资料:
[外链图片转存中…(img-bUlPEOzL-1714371679379)]
给大家整理的电子书资料:
[外链图片转存中…(img-t7pSITRI-1714371679380)]
如果本文对你有帮助,欢迎点赞、收藏、转发给朋友,让我有持续创作的动力!
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!