Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Take Data From Jenkins Output and Graph/Plot it

I need to pull certain numbers from the console output of a Jenkins build, and then plot that data on a graph. If my output is:

+ echo -153 -153 + echo master count: 13596 master count: 13596 Finished: SUCCESS

I want to pull the master count and -153. The master count is total number of errors while the -153 is the change of errors from two builds. I then want to make a graph using those 2 numbers.

So my question is, how do I send those two sets of data from the console to a graph in jenkins? The numbers will change over time and I wish to be able to see the trend in errors.

like image 356
AGomez Avatar asked Oct 17 '25 00:10

AGomez


2 Answers

Assuming that the shell code you listed above is under your control, the easiest way to do this is to echo the output to a CSV file instead of / as well as to the console, and then use the Jenkins Plot Plugin to display the results.

like image 184
gareth_bowles Avatar answered Oct 18 '25 13:10

gareth_bowles


This is exactly what the Plot Plugin is for.

You need to change your shell build step (or other part of the build) to create a separate file for each value that you want to plot. They need to be of the form:

YVALUE=<value>

In your example you would need a file "mastercount.txt" with:

YVALUE=13596

and another file called "diffcount.txt" with:

YVALUE=-153

Then under post-build actions you need to configure the plot-plugin to pick up these files and generate plots.

like image 42
pitseeker Avatar answered Oct 18 '25 14:10

pitseeker