peimanja / artifactory_exporter

JFrog Artifactory Prometheus Exporter written in Go
Apache License 2.0
140 stars 37 forks source link

Trouble connecting to artifactory container #99

Closed paulsso closed 1 year ago

paulsso commented 1 year ago

I've got the following in my environment file:

ARTI_USERNAME=xxx
ARTI_PASSWORD=xxx
ARTI_SSL_VERIFY=false
ARTI_SCRAPE_URI="http://artifactory:8081/artifactory"
ARTI_TIMEOUT="15s"

and these two containers in my docker-compose file:

  artifactory:
    image: docker.bintray.io/jfrog/artifactory-pro:7.xx.xx
    restart: unless-stopped
    environment:
      EXTRA_JAVA_OPTIONS: "
        -Xms512m
        -Xmx2g
        -Xss256k
        -XX:+UseG1GC"
        #-Xmx2g
    ports:
      - "8081:8081"
      - "8082:8082"
    volumes:
      - artifactory_home:/var/opt/jfrog/artifactory
      - /docker/old_artifactory:/home/artifactory/old_artifactory
      - backups:/home/artifactory/backups

  artifactory_exporter:
    image: peimanja/artifactory_exporter:latest
    env_file:
      - VARS_ARTIFACTORY
    ports:
      - "9531:9531"
    command:
      - "--log.level=debug"
    volumes:
      - /etc/ca-certificates:/etc/ca-certificates

artifactory_exporter can connect to prometheus but is unable to scrape from jfrog artifactory with the following error message:

level=debug ts=2023-02-05T18:17:59.159Z caller=system.go:77 msg="Fetching license stats"
level=debug ts=2023-02-05T18:17:59.159Z caller=utils.go:44 msg="Fetching http" path=http://artifactory:8081/artifactory/api/system/license
level=error ts=2023-02-05T18:17:59.172Z caller=utils.go:81 msg="There was an error making API call" endpoint=http://artifactory:8081/artifactory/api/system/license err="[map[message:Forbidden status:403]]" status=(MISSING)

Can anyone give me a clue as to what is going on here? Is it an issue with the certs? Am I directing the exporter inappropriately?

paulsso commented 1 year ago

I updated the username and password to an account with admin privileges and now it works. At least I'm not getting

[map[message:Forbidden status:403]]" status=(MISSING)

peimanja commented 1 year ago

Hi @paulsso, so yes as it's mentioned here, the user need to be an admin