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
  1. First - convert the raw nmon data (.nmon) file in JSON data (.json)
    • nmon2json myfile.nmon >myfile.json
  2. Second - edit the nmon_injector.py and change the host, user and password to match your InfluxDB configuration
  3. 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

  1. Fixes to use ISO standard date-time strings
  2. Stats collection data: hostname, time stamp, Serial number, OS details etc.
  3. Lots of CPU stats
  4. LPAR config and use
  5. Memory, new memory, memory use
  6. Paging
  7. Large page
  8. Proc stats - run queue, system calls etc.
  9. File = directory look-up
  10. Network totals
  11. Network individually - new
  12. Disk totals
  13. Disk individually - new
  14. Adapter individually - new
  15. AIO - Async I/O

Possible "to do" projects:

  • What would you like next?
  1. JFS?
  2. Network Block Size?
  3. Disk Block Size?
  4. More general config data?
  5. Top Processes?

Sample graphs

  • nmon to nmon2json to nmon_injector to InfluxDB to Grafana

Downloads

  • You need BOTH of these files
Download FileComments
nmon2json_to_InfluxDB_injector.py21st Feb 2019
- Upload nmon2json output JSON files in to InfluxDB - YOU NEED TO CHANGE THIS FILE BEFORE USE
nmon2json_v32.tarVersion 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=nmon2jsonSimple Grafana Dashboard for nmon2json graphs.
Nothing fancy but might get you started.
Hard codes hostname= "engine" in each graph will need changing.