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

Cannot set username and apikey to make the collector run successfulyy

xiegudong45 opened this issue · comments

Hi,

I have some problems to make this collector run successfully. I have followed your instructions regarding applications.properties, adding "jenkins.usernames[0]" as my jenkins username and "jenkins.apiKeys[0]" as the username's api token. However it seems to have some 403 forbidden error when grabbing data from my Jenkins server. However, when I gave full authentication to Anonymous Users, it would work.

Here is my Application.properties file:

# 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=

# Database Password - default is blank
dbpassword=

# Collector schedule (required)
jenkins.cron=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://jenkinsserver:8080

# If using username/token for API authentication
# (required for Cloudbees Jenkins Ops Center) For example,
# jenkins.servers[0]=http://ct_builder:1119e3879bcb7dc00b1f4b87c51a88a353@jenkinsserver:8080

# Another option: If using same username/password Jenkins auth,
# set username/apiKey to use HTTP Basic Auth (blank=no auth)
jenkins.usernames[0]=djaioc
jenkins.apiKeys[0]=abcdefg

# 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=20000
jenkins.readTimeout=20000

Here's the error:

2020-01-19 14:31:15,550 [taskScheduler-1] WARN  c.c.d.collector.DefaultHudsonClient - Credentials for the following url was not found. This could happen if the domain/su
bdomain/IP address in the build url returned by Jenkins and the Jenkins instance url in your Hygieia configuration do not match: "http://JenkinsServer:8080/job/AUTO_Depl
oy/1/api/json?tree=number,url,timestamp,duration,building,result,culprits[fullName],changeSets[items[user,author[fullName],revision,id,msg,timestamp,date,paths[file]],ki
nd],changeSet[items[user,author[fullName],revision,id,msg,timestamp,date,paths[file]],kind,revisions[module,revision]],actions[lastBuiltRevision[SHA1,branch[SHA1,name]],
remoteUrls]"
2020-01-19 14:31:15,554 [taskScheduler-1] ERROR c.c.d.collector.DefaultHudsonClient - Client exception loading build details: 403 Forbidden. URL =http://JenkinsServer:80
80/job/AUTO_Deploy/1/

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.