I’ve got a task of automating postman smoke tests to run every x minutes in kubernetes cluster and pushing results into prometheus, later visualized by grafana, with alerts pushed to a mattermost channel.
I’ve created a custom docker image based on alpine with newman and other packages (I didn’t use newman docker image because I cannot add there whatever I want), copied all my collections and env. files into the docker image as well, the command of
newman run is also packed into the dockerfile (otherwise it did not work if I invoked it from the pod definition yaml in kubernetes). All what is necessary is to run the container and it creates a report placed in
/newman folder inside the container.
I’ve created kubernetes cronjob to run the container, it runs and gets into the completed state. If I keep container open with some loop command I can login and make sure that the results are there (and they are). Since this job is ephemeral and prometheus won’t have time to scrap it, I’m trying to push the results into the prometheus pushgateway (which I’ve deployed for this reason). I’m trying to
curl the results into it (command also defined in the dockerfile), something like
cat myreport.xml | curl --data-binary @- push-prometheus-pushgateway:9091/metrics/job/newman
However here is the problem: I cannot get results formatted for it to be accepted by prometheus pushgateway in any meaningful way. I did not find any custom ‘reporter’ either which may suit this purpose. Currently I’m using
junit reporter, but I did not manage to
sed/awk the output to be digested by pushgateway and for it to make any practical sense…
Had anyone done anything similar already in the past and reached some success in it?
Many thanks in advance!
Source: Dockerfile Questions