Python's posture to analyze nmon and get performance metrics data is like this

Source: Internet
Author: User

a background

in a performance test or Linux Server operations, will involve the use of system resources monitoring, in addition to common system commands (such as top,iostat,free, etc.), a more comprehensive resource data monitoring tool is NMON, by running NMON on the server, You can periodically monitor the hardware resources and generate the collected data into a . NMON file. So, the question is, how do you parse the. Nmon file and get the performance data you care about in automated monitoring?

two nmon and its common data processing methods

The Nmon is a free tool for system monitoring, performance test analysis, and tuning , providing a one-time information on a wide range of performance metrics for system and resource usage, such as CPU , memory, network, disk IO and so on.

Common uses of Nmon are:

1. turn on Nmon

./nmon_linux_64-s 10-c 60-f-m/home/nmon

where -s specifies the time of each acquisition interval;-c Specifies the number of acquisitions;-f Specifies that the output is in spreadsheet format; -M switches the directory before the command saves the data to a file.

2. analyze nmon data

with the above command, after the number of acquisitions arrives, the Xxxx.nmon file is generated in the specified directory , and the common way to analyze. Nmon files is to use nmon_analyser.xlsm, by importing A. Nmon file that displays data in an Excel file.

three python parsing The posture of Nmon

through the above analysis, the common method of obtaining Nmon file data is mainly applied in interactive mode, and it is not suitable for performance automation or automatic operation and maintenance monitoring. Here 's how to parse the Nmon file and get performance metrics data using Python.

First , the. Nmon file is essentially a text file that can be read and written directly using Python;

Second , by analyzing the location of the data of the concerned indicator, the data is obtained by the regular matching method;

finally , the data summary is written to HTML toshow the usage of resources on each server;

According to the above ideas, to achieve the resolution . Nmon and get the CPU usage code as follows:


Access to other resources is similar and is not to be mentioned.

four effect Display

The results of analyzing the. nmon files for each server and generating an HTML report are as follows , based on the implemented script :


five Summary

Nmon is a common performance monitoring tool, the common nmon_analyser.xlsm tool Analysis Nmon method is not applicable in performance automation, thus introduced the use of Python script directly analysis Nmon The file and obtain performance metrics data.


Python's posture to analyze nmon and get performance metrics data is like this

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: info-contact@alibabacloud.com 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.