kinduff / csgo_exporter

A Prometheus exporter for Counter-Strike: Global Offensive.
Apache License 2.0
19 stars 3 forks source link

Unable to retrieve stats #3

Closed wlbr closed 3 years ago

wlbr commented 3 years ago
$ HTTP_PORT=5150 STEAM_API_KEY=233myownkey2323 STEAM_ID=2myid3 ./csgo_exporter
INFO[0000] Listening on http://localhost:5150
INFO[0009] Sending HTTP request to https://api.steampowered.com/ISteamUserStats/GetUserStatsForGame/v0002?appid=730&key=233myownkey2323 &steamid=2myid3
FATA[0010] An error has occurred during retrieving statistics <nil> 
kinduff commented 3 years ago

@wlbr Looks like you have an extra space at the end of your API key, for some weird reason. Try using a .env file, or export each one before running the script.

The URLs the exporter uses are accessible directly on the browser, so if you copy and paste the URL from the console from the INFO log, it should return a JSON response as expected.

wlbr commented 3 years ago

Thanks for the quick response, that's great!

I am having the same issue running the thing in Docker, where the variables are set through the docker compose file, so that seems to be different.

 csgo-exporter:
    privileged: true
    image: kinduff/csgo_exporter
    container_name: csgo_exporter
    restart: always
    ports:
      - "9322:9322"
    volumes:
      - /volume1/docker/prometheus/data/csgo:/csgo
    environment:
      - STEAM_API_KEY=1234567890
      - STEAM_ID=12345
      - HTTP_PORT=9322
  I tried the call with the browser - same results (error).

  will try again using exports.
wlbr commented 3 years ago

Got it, my fail. I had a wrong steam ID. I always thought that the number being displayed as the directory name of my configs on my local machine would be the steam ID. It is not. Actually you need to go to https://steamcommunity.com/id/wolberine/edit/info remove you custom URL and look at the tooltip that's being showed below the edit field.

Is that something for the docs?

kinduff commented 3 years ago

Nice! Glad you got it working.

I may add this information to the README, and highlight the fact that you can use your Steam username and the exporter takes care to retrieve the ID.

Thanks!

wlbr commented 3 years ago

Ah, Steam username != profile name I thought that using the profile name would be a bad idea, because that changes sometimes. But you are really talking about the Steam username. Again my fault :-)