hygieia / hygieia-build-jenkins-collector

Hygieia Collector to extract data from Jenkins and feed into Hygieia

Home Page:https://github.com/Hygieia/Hygieia/blob/gh-pages/pages/hygieia/collectors/build/jenkins.md

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Jenkins Collector Error due to old credentials - 403 Access Denied

chenthilan opened this issue · comments

I use the below command to start the Jenkins collector. This new property file completely different creds to the old one. But still in the logs i see the old password and user printed. Not sure if it is reading the property file or where it is taking the old credentials from. Those credentials have already expired.

java -jar jenkins.jar --spring.config.name=jenkins --spring.config.location=absolutepath/jenkins_dp5252.properties

Below from the logs,

2019-07-08 22:10:00,001 [taskScheduler-1] INFO c.c.d.collector.CollectorTask - Running Collector: Hudson
2019-07-08 22:10:00,692 [taskScheduler-1] INFO c.c.d.collector.CollectorTask - -----------------------------------
2019-07-08 22:10:00,692 [taskScheduler-1] INFO c.c.d.collector.CollectorTask - Jenkins endpoint
2019-07-08 22:10:00,692 [taskScheduler-1] INFO c.c.d.collector.CollectorTask - -----------------------------------
2019-07-08 22:10:00,693 [taskScheduler-1] INFO c.c.d.collector.DefaultHudsonClient - first userrrrrrrrrrrrrrrrrrrrrrrrrrrrInfo...: null
2019-07-08 22:10:00,693 [taskScheduler-1] INFO c.c.d.collector.DefaultHudsonClient - In isEmpty.....usernames... oldusername
2019-07-08 22:10:00,694 [taskScheduler-1] INFO c.c.d.collector.DefaultHudsonClient - In isEmpty.....apiKeys... oldpreviouspassword
2019-07-08 22:10:00,698 [taskScheduler-1] INFO c.c.d.collector.DefaultHudsonClient - In isEmpty.....sUrl... jenkinsendpoint/api/json?tree=jobs
2019-07-08 22:10:00,699 [taskScheduler-1] INFO c.c.d.collector.DefaultHudsonClient - second userrrrrrrrrrrrrrrrrrrrrrrrrrrrInfo...After isEmpty oldusername:oldpassword
2019-07-08 22:10:01,831 [taskScheduler-1] ERROR c.c.d.collector.DefaultHudsonClient - client exception loading jobs
org.springframework.web.client.HttpClientErrorException: 403 Access Denied
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:91) ~[spring-web-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]
at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:641) ~[spring-web-4.2.5.RELEASE.jar!/:4.2.5.RELEASE]

A small update.. when i did
db.getCollection("configuration").find() , i see the old username and oldpassword

{ "_id" : ObjectId("5cfe7cb0433a2cb20c69bcef"), "_class" : "com.capitalone.dashboard.model.Configuration", "collectorName" : "Hudson", "info" : [ { "url" : "Jenkinsendpoint", "userName" : "oldusername", "password" : "BASE64:oldpassword" } ] }

I suspect this is the issue. But i don't want to make the changes in the DB every time there is a user and password (apikey) update for Jenkins connectivity. How do i enable this to be read from the property file all the time?

Please let me know.

Please send your jenkins.properties file

@Madfish5415 ....Please find the contents of the property file below...

Database Name

dbname=dashboarddb

Database HostName - default is localhost

dbhost=localhost

Database Port - default is 27017

dbport=27017

MongoDB replicaset

#dbreplicaset=[false if you are not using MongoDB replicaset]
#dbhostport=[host1:port1,host2:port2,host3:port3]

Database Username - default is blank

dbusername=dashboarduser

Database Password - default is blank

dbpassword=dbpassword

Collector schedule (required)

jenkins.cron=0 0/5 * * * *

The page size

jenkins.pageSize=1000

The folder depth - default is 10

jenkins.folderDepth=10

Jenkins server (required) - Can provide multiple

#jenkins.servers[0]=http://jenkins.company.com
jenkins.servers[0]=http://jenkinsurl/jenkins

If using username/token for API authentication

(required for Cloudbees Jenkins Ops Center) For example,

#jenkins.servers[1]=http://username:token@jenkins.company.com

jenkins.usernames[0]=jenkinsuser
jenkins.apiKeys[0]=jenkinsapikey

Determines if build console log is collected - defaults to false

jenkins.saveLog=true

Search criteria enabled via properties (max search criteria = 2)

#jenkins.searchFields[0]= options.jobName
#jenkins.searchFields[1]= niceName

Timeout values

jenkins.connectTimeout=100000
jenkins.readTimeout=100000

commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.