-
-
Notifications
You must be signed in to change notification settings - Fork 427
Description
Describe the bug
A clear and concise description of what the bug is.
An error of division by zero shows up, but real cause is the poller_item table crashed, as below. And the no errors about the SQL reported in the Clog.
2019/11/05 14:25:08 - CMDPHP PHP ERROR WARNING Backtrace: (/poller_boost.php[137]:output_rrd_data(), /poller_boost.php[298]:CactiErrorHandler())
2019/11/05 14:25:08 - ERROR PHP WARNING: Division by zero in file: /opt/cacti/poller_boost.php on line: 298
MariaDB [cacti]> SELECT po.output, po.time, UNIX_TIMESTAMP(po.time) as unix_time, po.local_data_id, dl.data_template_id, pi.rrd_path, pi.rrd_name, pi.rrd_num FROM poller_output AS po INNER JOIN poller_item AS pi ON po.local_data_id=pi.local_data_id AND po.rrd_name=pi.rrd_name INNER JOIN data_local AS dl ON dl.id=po.local_data_id ORDER BY po.local_data_id;
ERROR 144 (HY000): Table './cacti/poller_item' is marked as crashed and last (automatic?) repair failed
To Reproduce
Steps to reproduce the behavior:
- Make a table crash, such as poller_item
- Run a SQL about the table.
- Check the Clog
Expected behavior
A clear and concise description of what you expected to happen.
The DB error should be reported correctly.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
Linux 7
Firefox 60
Smartphone (please complete the following information):
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
cacti 1.2.7
Additional context
Add any other context about the problem here.
The errorcode compare in the db_execute_prepared() is NOT right. Because a string always equal with 0. As below,
[root@yboliu_rhel720 /]# php -r "if('HY000' > 0) echo 'Bigger '; if('HY000' == 0) echo 'equal ';"
equal [root@yboliu_rhel720 /]#