Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem AWS Linux #38

Open
fagnerluz opened this issue Oct 17, 2018 · 12 comments
Open

Problem AWS Linux #38

fagnerluz opened this issue Oct 17, 2018 · 12 comments

Comments

@fagnerluz
Copy link

Hi!

I am having trouble running the script on new machines with AWS Linux, the old ones are running normally. Is there any change to make? Evidence follows.

[root@xxx zabbix-docker]# uname -a
Linux workers2 4.9.119-44.140.amzn1.x86_64 #1 SMP Fri Aug 10 19:17:29 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

[root@xxx zabbix-docker]# docker --version
Docker version 17.12.1-ce, build 3dfb8343b139d6342acfd9975d7f1068b5b1c3d3

[root@xxx zabbix-docker]# /usr/local/bin/zabbix-docker-stats.py 4223c203b334 pmem 271MB
[root@xxx zabbix-docker]# /usr/local/bin/zabbix-docker-stats.py 4223c203b334 lmem
Traceback (most recent call last):
File "/usr/local/bin/zabbix-docker-stats.py", line 110, in
print optionskey
File "/usr/local/bin/zabbix-docker-stats.py", line 62, in lmem
value = size_optionspdata[1][0]
KeyError: '1'

@fagnerluz
Copy link
Author

Zabbix 3.4

@rpsedlak
Copy link
Owner

So I haven't tested this on AWS Linux, however, I don't think that there is anything specific in Docker or Python for any Linux. At least there shouldn't be anything very specific.

Can you run the following command and provide me the output?

docker stats --no-stream=true

I suspect that the lmem value might not be returned or it has been removed from the Docker version that you're using. It's quite possible that the Docker version is different in the newer OS versions and that there was a change.

Please note that I do very seldom maintenance to this repo but I really appreciate your report. I do need to take some time and clean this code up for errors and recent changes to the tools.

@fagnerluz
Copy link
Author

fagnerluz commented Oct 17, 2018

Yes of course.

Follow:

[root@xxx zabbix-docker]# docker stats --no-stream=true
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
a4565f9c7a60 xxx 0.00% 58.92MiB / 200MiB 29.46% 118kB / 63.6kB 0B / 0B 0

I noticed that it does not refresh for a long time, if it is the case I will try to adjust and send a pull request for you to analyze.

Thank you very much for the quick response.

@rpsedlak
Copy link
Owner

Can you also include the output from the older servers? I'm wondering if the command has changed the output and the parser is now invalid.

@rpsedlak
Copy link
Owner

Actually, the command should be...

docker stats --no-stream=true

That's my bad. I haven't updated this particular code in 3 years.

@rpsedlak
Copy link
Owner

Argh...

docker stats --no-stream=true CONTAINERID

Where CONTAINERID is the docker container. In your example above it would be a4565f9c7a60.

@fagnerluz
Copy link
Author

That container died, follow another one.

[root@xxx zabbix-docker]# docker stats --no-stream=true 761b9e2e05ca
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
761b9e2e05ca xxx 0.02% 13.2MiB / 100MiB 13.20% 26.5MB / 33.2MB 94.2kB / 0B 0

The order must have changed even though we're getting the MB instead of%.

@fagnerluz
Copy link
Author

[root@xxx ~]# docker stats --no-stream=true
This is the return from the server that is OK.
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
fe1dc2f0c9be 0.01% 38.57 MiB / 3.86 GiB 0.98% 2.91 GB / 2.66 GB 45.1 kB / 0 B 0

@fagnerluz
Copy link
Author

I think NAME is in the way.

@rpsedlak
Copy link
Owner

Notice that the headers have changed.

CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS

What has also changed is the way they represent memory values. In the newer example, the lmem is 100MiB while the older example shows 3.86 GiB for the lmem. This "space" change is what's confusing the parser I expect.

I have to figure out how the code changes for this AND make sure that it doesn't break older versions.

Thank you so much for the data. I really appreciate it. I will definitely let you know once I figure this out.

@fagnerluz
Copy link
Author

Okay, I'll take a look at this too and I'll let you know if I find out.

Thank you very much for the conversation.

Hug.

@rpsedlak
Copy link
Owner

BTW, looking at the Python code and the data you provided, this problem exists on lines 57, 62, 67, and 72.

If you manage to fix it, please post the change or create a pull request so that we can help others. This repo has a few watchers and forks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants