336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
Dependency
<dependency>
|
목적
▶하둡 사용량, 메모리, CPU등 조회 후 관리 Web에서 pie-chart로 실시간 변화 Dynamic하게 그리기
▶테스트 진행
Test
[Session Connect] Session session; session = jsch.getSession(USER, IP , 22); session.setPassword(PASSWORD); session.setConfig(config); session.connect(); Channel channel; String line = ""; try { channel = session.openChannel("exec"); //명령어 ((ChannelExec) channel).setCommand("cd /home/ksu/hadoop-2.6.4/bin/;" + "./hdfs dfsadmin -report;"); channel.setInputStream(null); ((ChannelExec) channel).setErrStream(System.err); InputStream in = channel.getInputStream(); channel.connect(); byte[] tmp = new byte[1024]; while (true) { while (in.available() > 0) { int i = in.read(tmp, 0, 1024); if (i < 0) break; line += new String(tmp, 0, i); } if (channel.isClosed()) { break; } try { Thread.sleep(time_delay); } catch (Exception ee) { } } String[] linesplit = line.split("\n"); for(int a = 0 ; a < linesplit.length ; a ++){ if(linesplit[a].contains("DFS Used%:")){ String disk_mem = linesplit[a].replace("DFS", "").replace("Used", "").replace("%", "").replace(":", "").replace(" ", ""); StaticSystem.disk_percent = Float.valueOf(disk_mem); break; } } channel.disconnect(); } catch (JSchException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } |
결과
▶ HDFS DISK 사용량 0.50% pie chart 확인
'프로그램' 카테고리의 다른 글
FCM - Firebase 클라우드 메시징 테스트 (0) | 2017.08.21 |
---|---|
quartz scheduler (0) | 2017.04.26 |
Spring - RMI (0) | 2017.04.24 |