Bug 44502

Summary: ОШИБКА: деление на ноль: в Predict Problems
Product: Sisyphus Reporter: Evgeny Shesteperov <alimektor>
Component: nagiosdiggerAssignee: manowar <manowar>
Status: CLOSED FIXED QA Contact: qa-sisyphus
Severity: normal    
Priority: P5 CC: manowar
Version: unstable   
Hardware: x86_64   
OS: Linux   

Description Evgeny Shesteperov 2022-11-30 16:33:52 MSK
Версия
======

nagiosdigger-0.9-alt6.noarch
nagios-3.0.6-alt16.x86_64
postgresql14-14.5-alt1.x86_64

Дистрибутивы
============

- p10-server-10-x86-64

Шаги воспроизведения
====================

1. Настроить nagios, клиентов с osec, настроить nagiosdigger на работу с PostgreSQL.
2. Получить некоторые логи с nagios.
3. Перейти в веб-интерфейс Nagiosdigger: https://server/nagiosdigger
4. Перейти в Predict Problems → pearson correlation, проверить значение.

Ожидаемый результат: отсутствие ошибок SQL.

Фактический результат: присутствуют ошибки SQL.

        Query failed: ОШИБКА: деление на ноль: SELECT host2, service2, ABS((psum - (sum1 * sum2 / n)) / sqrt((sum1sq - pow(sum1, 2.0) / n) * (sum2sq - pow(sum2, 2.0) / n))) AS r, n FROM (SELECT n1.host AS host1, n1.service AS service1, n2.host AS host2, n2.service AS service2, SUM(n1.count) AS sum1, SUM(n2.count) AS sum2, SUM(n1.count * n1.count) AS sum1sq, SUM(n2.count * n2.count) AS sum2sq, SUM(n1.count * n2.count) AS psum, COUNT(*) AS n FROM (SELECT host, service, hour, COUNT(*) AS count FROM logs WHERE status_type='HARD' GROUP BY host, service, hour) AS n1, (SELECT host, service, hour, COUNT(*) AS count FROM logs WHERE status_type='HARD' GROUP BY host, service, hour) AS n2 WHERE n1.hour = n2.hour AND n1.host = 'nagios-node-10.88.9.29' AND n1.service = 'A system file changed' AND (n2.host != 'nagios-node-10.88.9.29' OR n2.service != 'A system file changed') GROUP BY host1, service1, host2, service2) AS matching ORDER BY r DESC, n DESC LIMIT 5
Comment 1 Evgeny Shesteperov 2022-11-30 16:34:07 MSK
Воспроизводится в Sisyphus.
Comment 2 Repository Robot 2022-12-02 17:56:25 MSK
nagiosdigger-0.9.1-alt1 -> sisyphus:

 Fri Dec 02 2022 Paul Wolneykien <manowar@altlinux> 0.9.1-alt1
 - Fixed divide by zero in "Predict problems" (closes: 44502).
 - Fixed date/time functions for PostgreSQL (closes: 44501).