The Jenkins XML API is very useful for automating tasks like this – if you simply append “/api/xml” to a Jenkins job URL, it will serve up an XML version – note there is also a JSON API and a CLI and plenty of other options, but I’m using what suits me.
The Jenkins XML API
For example, if you go to one of your Jenkins jobs and add /api/xml like this: “http://yourjenkinsserver:8080/job/yourjobname/api/xml”
you should get back some XML, possibly roughly like this example:
<shortDescription>Started by upstream project “1.b Revert Cluster Machines (Main CI)” build number 1,112</shortDescription>
<upstreamProject>1.b Revert Cluster Machines (Main CI)</upstreamProject>
That XML contains loads of very useful information inside handy XML tag descriptions – you just need a way to get at that data and then you can present it as you like…
In order to monitor Jenkins data we will need to extract needed information from The Jenkins XML API and load it into a datamart. Then we can run monitoring based on the data we loaded from the Jenkins CI server.
Our process will be divided into 4 major chapters:
1. Create DM schema and objects.
2. Extract the data from the Jenkins CI server.
3. Load the data into dimension and fact tables.
4. Run reports based on the loaded data.