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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With