Skip to content
This repository has been archived by the owner on May 2, 2022. It is now read-only.

KeyError: 'lastBuild' #28

Open
nclsjstnn opened this issue Apr 13, 2018 · 3 comments
Open

KeyError: 'lastBuild' #28

nclsjstnn opened this issue Apr 13, 2018 · 3 comments

Comments

@nclsjstnn
Copy link

I'm having the following error using this exporter.

KeyError: 'lastBuild'
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/local/lib/python2.7/SocketServer.py", line 321, in process_request
    self.finish_request(request, client_address)
  File "/usr/local/lib/python2.7/SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/local/lib/python2.7/SocketServer.py", line 655, in __init__
    self.handle()
  File "/usr/local/lib/python2.7/BaseHTTPServer.py", line 340, in handle
    self.handle_one_request()
  File "/usr/local/lib/python2.7/BaseHTTPServer.py", line 328, in handle_one_request
    method()
  File "/usr/local/lib/python2.7/site-packages/prometheus_client/exposition.py", line 54, in do_GET
    self.wfile.write(generate_latest(core.REGISTRY))
  File "/usr/local/lib/python2.7/site-packages/prometheus_client/exposition.py", line 33, in generate_latest
    for metric in registry.collect():
  File "/usr/local/lib/python2.7/site-packages/prometheus_client/core.py", line 54, in collect
    for metric in collector.collect():
  File "./jenkins_exporter.py", line 30, in collect
    self._get_metrics(name, job)
  File "./jenkins_exporter.py", line 89, in _get_metrics
    status_data = job[status] or {}

What would it mean?
Thanks

@jeffreyalexander88
Copy link

Docker image seems out of date. When I ran the image lovoo/jenkins_exporter:latest I had the same issue. However, when I built the image locally and ran it I had no issues and it worked great. @jstnn

@scheung38
Copy link

scheung38 commented Sep 21, 2018

Hi @jeffreyalexander88 could you show us which version from the hub.docker.com page, still cannot successfully build after cloning...

 FROM python:2.7-slim

Also didn't work, thanks, this is error:

ConnectionError: HTTPConnectionPool(host='jenkins', port=8080): Max retries exceeded with url: /api/json?tree=jobs%5Bname%2ClastBuild%5Bnumber%2Ctimestamp%2Cduration%2Cactions%5BqueuingDurationMillis%2CtotalDurationMillis%2CskipCount%2CfailCount%2CtotalCount%2CpassCount%5D%5D%2ClastCompletedBuild%5Bnumber%2Ctimestamp%2Cduration%2Cactions%5BqueuingDurationMillis%2CtotalDurationMillis%2CskipCount%2CfailCount%2CtotalCount%2CpassCount%5D%5D%2ClastFailedBuild%5Bnumber%2Ctimestamp%2Cduration%2Cactions%5BqueuingDurationMillis%2CtotalDurationMillis%2CskipCount%2CfailCount%2CtotalCount%2CpassCount%5D%5D%2ClastStableBuild%5Bnumber%2Ctimestamp%2Cduration%2Cactions%5BqueuingDurationMillis%2CtotalDurationMillis%2CskipCount%2CfailCount%2CtotalCount%2CpassCount%5D%5D%2ClastSuccessfulBuild%5Bnumber%2Ctimestamp%2Cduration%2Cactions%5BqueuingDurationMillis%2CtotalDurationMillis%2CskipCount%2CfailCount%2CtotalCount%2CpassCount%5D%5D%2ClastUnstableBuild%5Bnumber%2Ctimestamp%2Cduration%2Cactions%5BqueuingDurationMillis%2CtotalDurationMillis%2CskipCount%2CfailCount%2CtotalCount%2CpassCount%5D%5D%2ClastUnsuccessfulBuild%5Bnumber%2Ctimestamp%2Cduration%2Cactions%5BqueuingDurationMillis%2CtotalDurationMillis%2CskipCount%2CfailCount%2CtotalCount%2CpassCount%5D%5D%5D (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7fdc1ab79e90>: Failed to establish a new connection: [Errno -2] Name or service not known',))

@liuxxsongxx
Copy link

Code line 89 has a bug,Should be modified to
status_data = job.get(status) or {}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants