Thursday, November 21, 2013

Import cfhistograms output into Excel

One of my team members asked if I would create a tool to import cfhistograms into Excel.

Done!  It's called Excel Import :)

This post will walk people through how to import cfhistograms into Excel via the the Import utility.   We'l use the recipe style for this one.


1)  nodetool cfhistograms output piped into a text file (we'll call this cfhistograms.txt)
2)  Excel (We'll use Excel 2011 for this item)


1) Create the cfhistograms text file using the following command:
./nodetool cfhistograms <keyspace> <columnfamily> <textfile>
here's an example of this on one of my test machines
./nodetool cfhistograms classproject recordscounter > /root/monitor/cfhistograms.txt

2)  Move your cfhistograms.txt file to a location that can be accessed by Excel. 
-- I placed my copy on my macbook 

3)  Open Excel and create a new workbook

4)  Select Import under the File menu
5)  Select Text File in the menu and click Import

6)  Select the input file and click Get Data
7) Ensure the Fixed Width radio button is selected and increase the "start import at row" to 2, then click Next

8)  Now create fixed width columns that align to the last character of each line.  
See the diagram for an example.
  Look at the top box for instructions on how to create columns.
  Once you have your columns created correctly, click Finish.
9)  Choose the destination for the .csv file and click Ok
10)  Enjoy your new Excel rendering of cfhistograms

Hope you all enjoyed this one.  I put almost a lot of effort into it, meaning about none :)

1 comment: