Python Nmon Analyzer: keeps you away from excel macros

Source: Internet
Author: User

Python Nmon Analyzer: keeps you away from excel macros

Nginx's monitor, also known as "Nmon", is a good tool for monitoring, recording, and analyzing Linux/* nix system changes over time. Nmon was initially developed by IBM and open-source in the summer of 2009. Today, Nmon is available on all Linux platforms and architectures. It provides a command line-based Real-time visual Report of the current system statistics, including CPU, RAM, network and disk I/O. However, the best feature of Nmon is that it can record system performance snapshots over time.

For example:nmon -f -s 1.

Nmon CPU and Disk utilization

A log file will be created, starting with some system metadata (AAA-BBBV), followed by a scheduled snapshot of the monitored system attributes, for example, CPU and memory usage. The output file is hard to be processed directly by the spreadsheet application, so the Nmon_Analyzer excel macro is born. If you are using Windows/Mac and installed with Microsoft Office, this tool is very good. If you do not have this environment, you can also use the Nmon2rrd tool, which can convert the log file into the RRD input file and generate the image. This process is rigid and troublesome. Now we have a more flexible tool. Let me introduce you to pyNmonAnalyzer, it provides a customizable solution to generate structured CSV files and simple HTML reports with images generated using matplotlib.


Getting started

System Requirements:

We can see from the name that we need python. PyNmonAnalyzer also depends on matplotlib and numpy. If you are using a debian derivative system, you need to install these packages first:

  1. $ sudoapt-get install python-numpy python-matplotlib


Obtain pyNmonAnalyzer:

You can clone the git Repository:

  1. $

Or, download: directly from here. (LCTT)

Next, we need a Nmon file. If not, you can use the instance provided in the release or record a sample yourself:nmon -F test.nmon -s 1 -c 120120 snapshots are recorded, one per second, and stored in the test. nmon file.

Let's take a look at the basic help information:

  1. $ ./ -h
  2. usage: [-h][-x][-d][-o OUTDIR][-c][-b][-r CONFFNAME]
  3. input_file
  4. nmonParser converts Nmon monitor files into time-sorted
  5. CSV/Spreadsheetsfor easier analysis, without the use of the
  6. MS ExcelMacro.Also included is an option to build an HTML
  7. report with graphs, which is configured through report.config.
  8. positional arguments:
  9. input_file Input NMON file
  10. optional arguments:
  11. -h,--help show this help message andexit
  12. -x,--overwrite overwrite existing results (Default:False)
  13. -d,--debug debug?(Default:False)
  14. -o OUTDIR,--output OUTDIR
  15. Outputdirfor CSV (Default:./data/)
  16. -c,--csv CSV output?(Default:False)
  17. -b,--buildReport report output?(Default:False)
  18. -r CONFFNAME,--reportConfig CONFFNAME
  19. Report config file,if none exists: we will write the
  20. default config file out (Default:./report.config)

This tool has two main options:

  1. Summon nmon files into a series of separate CSV files
  2. Use matplotlib to generate HTML reports with images

The following command generates both a CSV file and an HTML report:

  1. $ ./ -c -b test.nmon

This creates./dataDirectory, which contains a directory for storing CSV files (./data/csv/), A directory for storing PNG images (./data/img/) And an HTML report (./data/report.html).

By default, HTML reports use images to show CPU usage, disk usage, memory usage, and network transmission. All of these are defined in a self-explanatory configuration file (report.config). At present, this tool is not very flexible, because the CPU and MEMonAndoffOther configurations are not allowed. However, the next step will improve the plotting method and allow users to flexibly specify which data to use which plotting method.

These reports are still boring and can only print several basic markup charts, but their functions are still being improved. Currently, a wizard is developed to make configuration adjustment easier. If you have any suggestions, find any bugs or have any functional requirements, please contact me.

Python Nmon Analyzer: moving away from excel macros

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.