작성자: 주인장 디지문
(http://www.digimoon.net/)



Python Nmon Analyzer
의 설치 및 사용 방법입니다.

RHEL 6 & 7 기준으로 설명 드립니다

 

 

1. Python Nmon Analyzer 실행에 필요한 사전 환경 구성

 

1.1. gcc-c++ 설치

# yum install gcc-c++

 

 

1.2. 파이썬 도구 설치 - yum 또는 소스 직접 설치 방식 중 택일합니다. 소스 설치 방법은 외부인터넷 연결이 되어야 하므로 yum 권장합니다.

 

1.2.1. yum으로 설치

 

EPEL 레포지토리 구성

( https://fedoraproject.org/wiki/EPEL )


RHEL6
# rpm
Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm

RHEL7
# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

 

② 설치

# yum install python-pip python-matplotlib

 

python-pip EPEL, python-matplotlib base repo에서 받아 설치됩니다.

외부 인터넷 안 되는 시스템에서는 첨부한 rpm을 직접 설치하세요.
http://www.digimoon.net/rpms/python-pip-7.1.0-1.el6.noarch.rpm
http://www.digimoon.net/rpms/python-pip-7.1.0-1.el7.noarch.rpm

 

 

1.2.2. 소스 설치

 

pip 소스 다운로드 및 설치

https://pip.pypa.io/en/latest/installing.html 에서 아래 소스 다운로드

https://bootstrap.pypa.io/get-pip.py

 

# python ./get-pip.py

 

pip 도구로 matplotlib 설치

# pip install matplotlib

 

 

 

2. Python Nmon Analyzer 다운로드 및 사용

 

GitHub에서 다운로드

https://github.com/madmaze/pyNmonAnalyzer

pyNmonAnalyzer-master.zip 다운로드

 

다운로드하여 압축 풀고 확장자 py인 파일들의 퍼미션을 700으로 부여

# chmod 700 *.py

 

 

간단 사용법

# ./pyNmonAnalyzer.py -b -o testReport-localhost_160426_0000 -i localhost_160426_0000.nmon

 

아래는 README.md 내용입니다.

pyNmonAnalyzer
========

A tool for parsing and reshuffeling nmon's output into "normal" csv format.
Nmon puts out a long file with a system-info header at the beginning, followed
by a continuous stream of time stamped readings. This format makes it difficult
for analysis by standard Spreadsheet viewers without a fair amount of preprocessing.
The pyNmonAnalyzer aims to make this simpler, faster and more effective. In one
sweep the pyNmonAnalyzer creates CSV files and two HTML-based reports, one with static
graphs and one with interactive graphs powered by [dygraphs](http://dygraphs.com). This
project is currently a work-in-progress and therefore will hopefully improve in
functionality and usability. If you have questions, find a bug or have feature requests, please do
file an issues [here](https://github.com/madmaze/pyNmonAnalyzer/issues)

**Example Reports:**
---------------
- [Static Report](http://matthiaslee.com/scratch/pyNmonAnalyzer/data/report.html)
- [Interactive Report](http://matthiaslee.com/scratch/pyNmonAnalyzer/interactiveReport.html)


Goals:
-----
- make nmon log file analysis easier and faster
- create HTML based reports with embedded graphs
- create CSV files for more indepth data analysis
- interactive graphs for hands on analysis, perhaps using dygraph.js

Getting started:
-----
- [Python Nmon Analyzer: moving away from excel macros](http://matthiaslee.com/?q=node/38)

Installation:
-----
pyNmonAnalyzer is now available through pip and easy_install.   
If you have pip:   
```$> sudo pip install pyNmonAnalyzer```

If you'd like to mess with the source, please feel free to fork
this github repo and contribute back changes.
Dependencies: 
-----
This tool depends on the python numpy package and the matplotlib package.
* If you are on a Debian/Ubuntu based system: `sudo apt-get install python-numpy python-matplotlib` 
* If you are on a RHEL/Fedora/Centos system: `sudo yum install python-numpy python-matplotlib`


Usage:
-----
```
usage: pyNmonAnalyzer [-h] [-x] [-d] [--force] [-i INPUT_FILE] [-o OUTDIR]
                      [-c] [-b] [-t REPORTTYPE] [-r CONFFNAME]
                      [--dygraphLocation DYGRAPHLOC] [--defaultConfig]
                      [-l LOGLEVEL]

nmonParser converts NMON monitor files into time-sorted CSV/Spreadsheets for
easier analysis, without the use of the MS Excel Macro. Also included is an
option to build an HTML report with graphs, which is configured through
report.config.

optional arguments:
  -h, --help            show this help message and exit
  -x, --overwrite       overwrite existing results (Default: False)
  -d, --debug           debug? (Default: False)
  --force               force using of config (Default: False)
  -i INPUT_FILE, --inputfile INPUT_FILE
                        Input NMON file
  -o OUTDIR, --output OUTDIR
                        Output dir for CSV (Default: ./report/)
  -c, --csv             CSV output? (Default: False)
  -b, --buildReport     report output? (Default: False)
  -t REPORTTYPE, --reportType REPORTTYPE
                        Should we be generating a "static" or "interactive"
                        report (Default: interactive)
  -r CONFFNAME, --reportConfig CONFFNAME
                        Report config file, if none exists: we will write the
                        default config file out (Default: ./report.config)
  --dygraphLocation DYGRAPHLOC
                        Specify local or remote location of dygraphs library.
                        This only applies to the interactive report. (Default:
                        http://dygraphs.com/dygraph-dev.js)
  --defaultConfig       Write out a default config file
  -l LOGLEVEL, --log LOGLEVEL
                        Logging verbosity, use DEBUG for more output and
                        showing graphs (Default: INFO)
```

Example Usage:
-------------
First generate a report config, most likely the default is all you need. This creates ./report.config
```$> pyNmonAnalyzer --defaultConfig```

Build HTML report with *interactive* graphs for test.nmon and store results to testReport 
```$> pyNmonAnalyzer -b -o testReport -i test.nmon```

Build HTML report with static graphs for test.nmon and store results to testReport 
```$> pyNmonAnalyzer -b -t static -o testReport -i test.nmon```

Compile CSV formatted tables for data in test.nmon and store results to testOut 
```$> pyNmonAnalyzer -c -o testOut -i test.nmon```

Configuration:
-------------
To control which items get graphed(CPU, MEM etc) you need to configure the report.config file.
This is especially important for AIX NMON systems. To get a sense of what the config file
should look like, run `pyNmonAnalyzer --defaultConfig` this will generate "report.config" in
your local directory. It contians two examples, one for Linux and one for AIX systems.
Adjust them according to your device names, for Linux you'll want to set DISKBUSY to your sda1 or sdb1 or what ever.
You should be able to use **any** nmon performance stats, so DISKBUSY, DISKREAD, CPU1, CPU2 etc.

Troubleshooting:
---------------
- **It crashes or my graphs don't show anything!**  
    Have you looked at your current report.config? Is it customized to your device names?
- **My interactive report will not display! What did I do wrong?**  
    Since the interactive report uses javascript to load CSV files, your browser needs to be allowed to read local files(if you are viewing locally). Firefox has been th
e most reliable for me, chrome currently does not allow JS to access local files.

**Any other problems, file an issue or send me an email.**

Configuration:
-------------
To control which items get graphed(CPU, MEM etc) you need to configure the report.config file.
This is especially important for AIX NMON systems. To get a sense of what the config file
should look like, run `pyNmonAnalyzer --defaultConfig` this will generate "report.config" in
your local directory. It contians two examples, one for Linux and one for AIX systems.
Adjust them according to your device names, for Linux you'll want to set DISKBUSY to your sda1 or sdb1 or what ever.
You should be able to use **any** nmon performance stats, so DISKBUSY, DISKREAD, CPU1, CPU2 etc.

Troubleshooting:
---------------
- **It crashes or my graphs don't show anything!**  
    Have you looked at your current report.config? Is it customized to your device names?
- **My interactive report will not display! What did I do wrong?**  
    Since the interactive report uses javascript to load CSV files, your browser needs to be allowed to read local files(if you are viewing locally). Firefox has been th
e most reliable for me, chrome currently does not allow JS to access local files.

**Any other problems, file an issue or send me an email.**


License:
-------
```
Copyright (c) 2012-2015 Matthias Lee, matthias.a.lee[]gmail.com
Last edited: Feburary 25th 2015

This program 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 3 of the License, or
(at your option) any later version.

This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.

 

 

 

Creative Commons License