Skip to content

Error: float division by zero в sender.py #185

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

Closed
sgrinko opened this issue Jul 27, 2022 · 3 comments
Closed

Error: float division by zero в sender.py #185

sgrinko opened this issue Jul 27, 2022 · 3 comments
Assignees
Labels
Milestone

Comments

@sgrinko
Copy link
Contributor

sgrinko commented Jul 27, 2022

Уважаемые разработчики, на моей системе я постоянно получаю следующие ошибки:

Использую mamonsu 3.5
OS Centos 7.9
Mamonsu собирал из исходников

[INFO] 2022-07-27 20:03:40,896 - STATEMENTS -   started ...
[DEBUG] 2022-07-27 20:03:40,897 - PGSQL-(host=localhost db=mamonsu user=mamonsu port=5432)  -   Run: "SELECT dealloc, ceil(extract(epoch from stats_reset)) FROM public.pg_stat_statements_info;"
[DEBUG] 2022-07-27 20:03:40,900 - PGSQL-(host=localhost db=mamonsu user=mamonsu port=5432)  -   Run: "SELECT sum(shared_blks_read+local_blks_read+temp_blks_read)*8*1024, sum(shared_blks_written+local
[ERROR] 2022-07-27 20:03:40,963 - STATEMENTS    -   plugin statements caught error: float division by zero
[INFO] 2022-07-27 20:03:40,963 - STATEMENTS -   hint: enable debug level to full exception trace
[DEBUG] 2022-07-27 20:03:40,963 - STATEMENTS    -   Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/mamonsu-3.5.0-py3.6.egg/mamonsu/lib/plugin.py", line 170, in _loop
    self.run(self.sender)
  File "/usr/local/lib/python3.6/site-packages/mamonsu-3.5.0-py3.6.egg/mamonsu/plugins/pgsql/statements.py", line 146, in run
    zbx.send(zbx_key, value, all_items[key][4])
  File "/usr/local/lib/python3.6/site-packages/mamonsu-3.5.0-py3.6.egg/mamonsu/lib/sender.py", line 44, in send
    value = float(value - last_value) / (clock - last_time)
ZeroDivisionError: float division by zero

Прошу встроить в код проверку, что clock - last_time = 0 и наверное в этом случае либо ничего не посылать, либо послать 0 ?

@cuprumtan cuprumtan self-assigned this Jul 28, 2022
@cuprumtan cuprumtan added the bug label Jul 28, 2022
@cuprumtan cuprumtan added this to the 3.5.1 milestone Jul 28, 2022
@cuprumtan
Copy link
Contributor

@sgrinko добрый день! Да, проверка там определенно была нужна. Попробуйте 3.5.1.

@sgrinko
Copy link
Contributor Author

sgrinko commented Jul 28, 2022

Спасибо, пробую...

@sgrinko
Copy link
Contributor Author

sgrinko commented Jul 28, 2022

Всё работает корректно. Спасибо!

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

No branches or pull requests

2 participants