Network Management

After upgrading to SolarWinds Platform 2024.4, Database Maintenance is overdue related to InterfaceTraffic or InterfaceTraffic_CS due to Divide by Zero Error.

This article discusses how to resolve errors on database maintenance issues where database maintenance for TimeSeries tables (InterfaceTraffic_CS_Detail, InterfaceTraffic_CS_Hourly_Hist, InterfaceTraffic_CS_Daily_Hist, InterfaceTraffic_CS_Cur) fail due to "Divide by Zero" Error

First published date

11/4/2024 3:59 PM

Last published date

6/11/2025 3:09 PM

Overview

When reviewing the database maintenance logs found in C:\ProgramData\SolarWinds\Logs\Orion on the SolarWinds Platform server, the following error message may appear for TimeSeries Tables (i.e InterfaceTraffic)

Further checking the swdebugmaintenance.log file, this is due to a Divide by Zero Error:

2024-11-08 11:25:57,892 [5] ERROR SolarWinds.Data.DatabaseMaintenance.Reporter - [Failure] 0.27s Finalize Maintenance - InterfaceTraffic
Message:
--------------------------------------------
dbm_ExecuteMaintenance: dbm_AggregateData_part: dbm_AggregateTimeSerie_part: XACT_STATE=-1Divide by zero error encountered., WITH time_recalc
AS
(
SELECT
       [InterfaceID],
       ISNULL(CAST(DATEADD(HOUR, DATEDIFF(HOUR, '20000101', [Timestamp]), '20000101') AS datetime2), '20241024') AS [Timestamp],
       [NodeID],
       [In_Averagebps],
       [In_Minbps],
       [In_Maxbps],
       [In_TotalBytes],
       [In_TotalPkts],
       [In_AvgUniCastPkts],
       [In_MinUniCastPkts],
       [In_MaxUniCastPkts],
       [In_AvgMultiCastPkts],
       [In_MinMultiCastPkts],
       [In_MaxMultiCastPkts],
       [Out_Averagebps],
       [Out_Minbps],
       [Out_Maxbps],
       [Out_TotalBytes],
       [Out_TotalPkts],
       [Out_AvgUniCastPkts],
       [Out_MaxUniCastPkts],
       [Out_MinUniCastPkts],
       [Out_AvgMultiCastPkts],
       [Out_MinMultiCastPkts],
       [Out_MaxMultiCastPkts],
       [Weight]
  FROM InterfaceTraffic_CS_Detail_hist
 WHERE [Timestamp] >= '20241024'
   AND [Timestamp] < '20241025'
),
agg_data
AS
(
SELECT
       [InterfaceID],
       [Timestamp],
       [NodeID],
       CAST((SUM([In_Averagebps] * CAST([Weight] AS DECIMAL)) / (SUM([Weight]))) AS float) AS [In_Averagebps],
       CAST(MIN([In_Minbps]) AS float) AS [In_Minbps],
       CAST(MAX([In_Maxbps]) AS float) AS [In_Maxbps],
       CAST(SUM([In_TotalBytes]) AS float) AS [In_TotalBytes],
       CAST(SUM([In_TotalPkts]) AS float) AS [In_TotalPkts],
       CAST((SUM([In_AvgUniCastPkts] * CAST([Weight] AS DECIMAL)) / (SUM([Weight]))) AS float) AS [In_AvgUniCastPkts],
       CAST(MIN([In_MinUniCastPkts]) AS float) AS [In_MinUniCastPkts],
       CAST(MAX([In_MaxUniCastPkts]) AS float) AS [In_MaxUniCastPkts],
       CAST((SUM([In_AvgMultiCastPkts] * CAST([Weight] AS DECIMAL)) / (SUM([Weight]))) AS float) AS [In_AvgMultiCastPkts],
       CAST(MIN([In_MinMultiCastPkts]) AS float) AS [In_MinMultiCastPkts],
       CAST(MAX([In_MaxMultiCastPkts]) AS float) AS [In_MaxMultiCastPkts],
       CAST((SUM([Out_Averagebps] * CAST([Weight] AS DECIMA...
Warning: Null value is eliminated by an aggregate or other SET operation.

 

Product section

Network Performance Monitor

Cause

This issue occurs due to a 0 or lesser Value in the Weight Column. The stored procedure consists of an operation that performs a division where the Weight Column is a Divisor. A number divided by zero or less leads to an indeterminate value.

Resolution

 

Note: This issue is addressed in SolarWinds Platform 2025.2. Consider upgrading your environment. If you cannot upgrade to this version, please use the steps below.

 

To resolve this issue, you would need to first run the script to clear the existing negative values in the database, then upgrade to SolarWinds Platform 2024.4.1. 

 

Warning:  Upgrading alone to SolarWinds Platform 2024.4.1 will not help resolve the issue, as it will not clear the database of the negative numbers.

 

Follow the steps below to troubleshoot: 

Step 1: Run the script to clear existing negative values in the database

  1. Take a full backup of the database to ensure you do not lose your data.
  2. Open Microsoft SQL Server Management Studio (SSMS) and connect to the Orion database.
  3. In the following directory (C:\ProgramData\Solarwinds\Logs\Orion), find swdebugmaintenance.log and review for the affected table. In this example, it is the InterfaceTraffic_CS_* table.
  4. Execute the following SQL script:
-- Scripts are not supported under any SolarWinds support program or service.
-- Scripts are provided AS IS without warranty of any kind. SolarWinds further
-- disclaims all warranties including, without limitation, any implied warranties
-- of merchantability or of fitness for a particular purpose. The risk arising
-- out of the use or performance of the scripts and documentation stays with you.
-- In no event shall SolarWinds or anyone else involved in the creation,
-- production, or delivery of the scripts be liable for any damages whatsoever
-- (including, without limitation, damages for loss of business profits, business
-- interruption, loss of business information, or other pecuniary loss) arising
-- out of the use of or inability to use the scripts or documentation.

UPDATE InterfaceTraffic_CS_Detail_Hist SET [Weight] = 120 WHERE [Weight] <= 0
UPDATE InterfaceTraffic_CS_Hourly_Hist SET [Weight] = 120 WHERE [Weight] <= 0
UPDATE InterfaceTraffic_CS_Daily_Hist SET [Weight] = 120 WHERE [Weight] <= 0
UPDATE InterfaceTraffic_CS_Cur SET [Weight] = 120 WHERE [Weight] <= 0
  1. Run the Database Maintenance manually or wait for the scheduled DB Maintenance to complete. By default, the database maintenance runs nightly at 2:15 AM.

Step 2: Upgrade to SolarWinds Platform 2024.4.1

 

Note: If an upgrade isn't possible, then you may periodically run the script to clear existing negative values in the database (See Step 1). Running the script once may not prevent the error from happening again.