Site /
Nmon2json
nmon2json - reformat your nmon files to JSON format
nmon2json is a Korn shell script for AIX or Linux to convert nmon collected files to JSON
- which is Python friendly and accepted by online Time-Series database like InfluxDB, Splunk and ELK (logstash)
It is ~600 lines of fairly simple Ksh script, so please fix bugs or add functions and let me know the changes.
Syntax:
- nmon2json nmonfile.nmon - outputs to stdout so redirect or pipe some where
- nmon2json -h for help & version
Notes for version 27,30 and 31:
- Added individual Networks, Disk and Adapter stats
- Stats are now split out into sub dictionaries like: "cpu", "lpar", "memory", "disk" etc.
- Dates-time strings are now ISO format
- Indentation for easy reading
- In Python terms, it generates a List of Dictionaries - one Dictionary per snapshot
- Version 31 changes to let us use the njmon injector code (with minimal changes) to inject the .json files into InfluxDB
Before you start:
- Install InfluxDB
- Then create a nmon database within it, like this:
$ influx > show databases > create database nmon > show databases > exit
- Do not insert nmon data into a njmon database = Never tested and more than likely to throw errors as the data format is different.
- Also install Grafana - this could be on the InfluxDB computer or locally on your laptop/workstation.
Example:
- After the nmon collection is finished
- First - convert the raw nmon data (.nmon) file in JSON data (.json)
- nmon2json myfile.nmon >myfile.json
- Second - edit the nmon_injector.py and change the host, user and password to match your InfluxDB configuration
- Third - inject the JSON (.json) file into InfluxDB
- cat myfile.json | nmon_injector.py
- Alternatively, convert and inject in one go into InfluxDB (Assuming you edited the Injector program as above)
- nmon2json myfile.nmon | nmon_injector.py
Example of generated JSON data are in the .tar file for AIX and Linux
Data already supported
- Fixes to use ISO standard date-time strings
- Stats collection data: hostname, time stamp, Serial number, OS details etc.
- Lots of CPU stats
- LPAR config and use
- Memory, new memory, memory use
- Paging
- Large page
- Proc stats - run queue, system calls etc.
- File = directory look-up
- Network totals
- Network individually - new
- Disk totals
- Disk individually - new
- Adapter individually - new
- AIO - Async I/O
Possible "to do" projects:
- What would you like next?
- JFS?
- Network Block Size?
- Disk Block Size?
- More general config data?
- Top Processes?
Sample graphs
- nmon to nmon2json to nmon_injector to InfluxDB to Grafana
Downloads
- You need BOTH of these files
Download File | Comments |
nmon2json_to_InfluxDB_injector.py | 21st Feb 2019 - Upload nmon2json output JSON files in to InfluxDB - YOU NEED TO CHANGE THIS FILE BEFORE USE |
nmon2json_v32.tar | Version 32 - 9th Dec 2019 - Includes some sample files and the JSON resulting output - v32 handles 68 things on a line like disks. - Above this number it will go horrible wrong. - Contact me if you hit this limit! - Converts nmon files to JSON. - Fixes to match the njmon .JSON output style for an easier life |
https://grafana.com/grafana/dashboards?search=nmon2json | Simple Grafana Dashboard for nmon2json graphs. Nothing fancy but might get you started. Hard codes hostname= "engine" in each graph will need changing. |