At 23:34 12.05.2023, you wrote:

>Hi There, 
>
>I am looking for a way to gather Jenkins's usage statistics such as builds run 
>every month or day. I came across a script at 
>https://github.com/jenkinsci/jenkins-scripts/blob/master/scriptler/jobExecutedInDateRange.groovy.
> However, it is not working as expected. 
>
>https://plugins.jenkins.io/global-build-stats/ is also not working as expected 
>and we don't want to use this plugin for security reasons.
>
>How can I achieve this? Please advise. 

I was looking for similar information, so I could see when many jobs want
to use the same lockable resource or when an agent could be better used.
As I couldn't find such information I resorted to the API (via web calls) to
poll for running jobs and locked resources. This information is stored in
a file where I can then use a script to create a table of when was running
what and where. You could probably do the same to get the desired
statistics out of this data. I wrote it in python as there's a plugin to access
Jenkins but maybe someone with more internal knowledge could turn this
into a Jenkins plugin.

import jenkins

server = jenkins.Jenkins('http://YOURJENKINS', username='USER', 
password='PASS', timeout=300)
queue = server.get_queue_info()
running = server.get_running_builds()

Maybe that helps. If there is a better way I'd be glad to hear about it as
I don't like my solution too much either.

bye  Fabi

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/bda7f59b6d8921079d941836474a1daa%40indel.ch.

Reply via email to