991jo / srcds_exporter

an prometheus exporter for SRCDS based gameservers (like CSGO, TF2, L4D2, ...).
17 stars 5 forks source link

Don't require the output of stats to be exactly 3 lines #10

Closed TechSupportJosh closed 5 years ago

TechSupportJosh commented 5 years ago

[14/04/2019 17:47] ERROR test handler 132: not enough values to unpack (expected 3, got 2) Traceback (most recent call last): File "main.py", line 117, in handler names, values, _ = [a.split() for a in stats.splitlines()] ValueError: not enough values to unpack (expected 3, got 2)

Looks like stats does not always return 3 lines. I've modified the code to look at any amount of lines and then deal with the first two.

991jo commented 5 years ago

okay, what kind of server are you monitoring?

larrryfisherthefisherman commented 5 years ago

This would have been a CSGO server, and he fixed one of the problems I was encountering with the script.

output of stats

  CPU   NetIn   NetOut    Uptime  Maps   FPS   Players  Svms    +-ms   ~tick
  10.0      0.0      0.0    1349     1  102.55       0    1.43    0.16    0.01
991jo commented 5 years ago

Interesting. my CSGO servers always returned 3 lines. I will test this tomorrow and merge it if everything is fine. Thanks for the pull request.

TechSupportJosh commented 5 years ago

Glad to help 👍

991jo commented 5 years ago

Okay took me a bit longer than promised to do this, but it's done now. Thank you very much for the pull request.