nmon+Java Nmon Analyser进行nmon监控数据可视化分析

旧城冷巷雨未停 提交于 2020-01-12 22:13:30

我们知道nmon是一款轻量级的系统占用极少,监控功能非常强大支持跨平台ARM,centos,ubuntu等等系统的工具

在sourceforge我们可以找到一个基于java编写的解析nmon监控出来的.nmon格式数据解析成报告jar包;

sourceforge地址:https://sourceforge.net/projects/jnmonanalyser/files/

由于nmon本身自带的也有Nmon Analyser,这里我不在介绍,看个人喜好,以及实际监控数据的文件结果大小,选取合适解析工具;

下面我们一起使用这个Java Nmon Analyser:

 

 

 下载下来后是一个简单的jar包以及它的开发者的一个简单的readme.txt:

User's  guide
----------------
1. Download and install nmon.
 - for linux platform, you can download form: http://nmon.sourceforge.net.
 - For AIX platform, you can download form : http://www.ibm.com/developerworks/wikis/display/WikiPtype/nmon , AIX 5.3 TL09+ and AIX 6.1 TL02 include nmon function within topas and its installed by default.

2. Make a pipe for nmon.
#mkfifo /tmp/nmonnamedpipe 

3. Run analyser's agent in target host:
# java -cp nmonanal_0.1.2.jar li.xiang.nmonanalyser.agent.Agent

4. Run nmon, begin performance capture.
 #nmon -s 20 -c 360 -F /tmp/nmonnamedpipe  
20 second per snapshot, capture 360 snapshots, totally 2 hrs. you can put the command in crontab for long time data capture.

5. Run java nmon analyser gui.
# java -jar nmonanal_0.1.2.jar

5.1 Get the real-time performance data from agent

Main menu --> " Data Loader "  --> "from agent".  Input the target's ip address and port number(default is 8187).

5.2 Get the performance data form nmon data collection file.

Developer's guide.
-------------------

The interface NmonDataLoader load nmon data for analyzing, Interface NmonDataListener is observer of NmonDataLoader. It can  rgister in NmonDataLoader, NmonDataLoader callback  NmonDataListener, when NmonDataLoader read a nmon output line. NmonDataListener parser the nmon data and return the performance charts by getCharts().

There 2 NmonDataLoader implement : NmonFileLoader and NmonAgentLoader , NmonFileLoader  load nmon data from nmon collection file. NmonAgentLoader load nmon data from agent. 

There 3 NmonListener implement: CPUTagCharts, MEMTagCharts, PaginTagCharts, DiskTagCharts and NetworkCharts. 

The sample load data from nmon file, and get the CPU cacategory performance charts : 


NmonDataLoader loader = new NmonFileLoader("/tmp/nmonsampleoutput.nmon");
CPUTagCharts  cpuCharts = new CPUTagCharts();
loader.addDataObserver(cpuCharts);
Thread loadThread = new Thread(loader);
loadThread.start();
JFreeChart[] charts = cpuCharts.getCharts();  

 使用也很简单直接双击jar包或者cmd执行java  -jar  nmonanal_0.1.3.jar  打开GUI界面选取你nmon监控生成的.nmon文件就可以了,此外它还可以支持agent模式见readme.txt,有详细介绍我就不再介绍了监控信息包含cpu,disk,NETWork,paging:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!