Error polling ports module - divide by zero in includes/polling/ports.inc.php

Here is my validate.php, I have two other pollers as well, but I seem to be having this issue randomly on a standalone full stack as well. OS is a patched Ubuntu 22.04.

librenms@libre01:~$ ./validate.php
===========================================
Component | Version
--------- | -------
LibreNMS  | 23.7.0-66-ga71ca98fa (2023-08-09T03:30:16+01:00)
DB Schema | 2023_08_02_120455_vendor_ouis_unique_index (255)
PHP       | 8.1.2-1ubuntu2.13
Python    | 3.10.12
Database  | MariaDB 10.11.4-MariaDB-1:10.11.4+maria~ubu2204
RRDTool   | 1.7.2
SNMP      | 5.9.1
===========================================

[OK]    Composer Version: 2.5.8
[OK]    Dependencies up-to-date.
[OK]    Database connection successful
[OK]    Database Schema is current
[OK]    SQL Server meets minimum requirements
[OK]    lower_case_table_names is enabled
[OK]    MySQL engine is optimal
[OK]    Database and column collations are correct
[OK]    Database schema correct
[OK]    MySQl and PHP time match
[OK]    Distributed Polling setting is enabled globally
[OK]    Connected to rrdcached
[OK]    Active pollers found
[OK]    Dispatcher Service not detected
[OK]    Locks are functional
[OK]    Python poller wrapper is polling
[OK]    Redis is functional
[OK]    rrdtool version ok
[OK]    Connected to rrdcached

The issue that presents is seemingly randomly, an event will appear on a device (typically a Linux device, I havent spotted any on windows machines), where “Error polling ports module. Check log file for more details.” will appear in the event log. This seems to have been happening since around the 29th Jul on my standlone stack and I’ve only just noticed it through testing on this distributed poller stack which is still in test…

So, checking the logs/librenms.log reveals the below, it seems to be a divide by zero related issue. I thought this might have been something to do with the distributed pollers having some kind of race condition, or perhaps redis not working, but most of the time things are all good. To troubleshoot that I still observe them with one machine doing the polling (but appears to be random). Also wondering if it was corrupted RRD files, although graphs from rrdcached are all sound. I removed all devices and discovered them again, but still random poller module errors occur.

Here is a log snippet when the problem occurs, the devices which I have under monitoring test are just very basic Ubuntu virtual machines.


/opt/librenms/poller.php 70 2023-08-09 22:31:06 - 1 devices polled in 3.244 secs
/opt/librenms/poller.php 76 2023-08-09 22:32:05 - 1 devices polled in 2.948 secs
Error polling ports module for libredb01.libretestdomain.local. DivisionByZeroError: Division by zero in /opt/librenms/includes/polling/ports.inc.php:783
Stack trace:
#0 /opt/librenms/includes/polling/functions.inc.php(339): include()
#1 /opt/librenms/poller.php(126): poll_device()
#2 {main}
/opt/librenms/poller.php 77 2023-08-09 22:32:05 - 1 devices polled in 3.184 secs
Division by zero {"exception":"[object] (DivisionByZeroError(code: 0): Division by zero at /opt/librenms/includes/polling/ports.inc.php:783)"}
/opt/librenms/poller.php 66 2023-08-09 22:32:05 - 1 devices polled in 3.240 secs
/opt/librenms/poller.php 65 2023-08-09 22:32:05 - 1 devices polled in 3.249 secs
/opt/librenms/poller.php 59 2023-08-09 22:32:06 - 1 devices polled in 3.235 secs

I’m a bit stuck for ideas apart from keeping trying to update it but its on the latest ver as far as I can see, and daily.sh runs with no problems.

Hope someone can help.

I found a similar error in the forum, but it had no replies hence my hand up for some assist.

Many thanks for reading

Chris

ok, so I found my problem, I think it must have been missing lock messages (I had an own-goal with regards to my redis instance as I had an inadvertent IP conflict! Doh!!!).

Still getting Errors polling ports module on my singular stack though (randomly). I have some performance optimisations to do on that though as I have a feeling it might be too loaded.

If anyone has any ideas on that though, I would appreciate the feedback

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.