Failed getting user_utilization from

Current Development version likely to have breaking changes
Post Reply
Detlef Paschke
Posts: 27
Joined: Tue Sep 12, 2023 6:14 pm

Failed getting user_utilization from

Post by Detlef Paschke »

Hello,

I'm currently testing Zoneminder 1.37.47 and I noticed that the following message appears in the log several times per minute.

zmstats[951].WAR [main:73] [Failed getting user_utilization from ]

Many greetings
Detlef Paschke
Last edited by Detlef Paschke on Wed Dec 27, 2023 10:58 am, edited 2 times in total.
pepex7
Posts: 37
Joined: Wed Feb 08, 2023 11:55 pm

Re: Failed getting user_utilization from

Post by pepex7 »

do you have more log?
I have been using 1.37.47 on Ubuntu 22.04 server and I have not received that error.
Detlef Paschke
Posts: 27
Joined: Tue Sep 12, 2023 6:14 pm

Re: Failed getting user_utilization from

Post by Detlef Paschke »

Hello,

I have Zoneminder installed on a Debian 12 VM under Proxmox.

This is the maximum information I can get with Debug Level 9.

Code: Select all

20.12.2023 10:03:08.661514 zmstats[1241].DB1 [ZoneMinder::Logger:321] [LogOpts: level=DB9/DB1, screen=OFF, database=WAR, logfile=DB1->/var/log/zm/zmstats.log, syslog=WAR]
20.12.2023 10:03:08.661970 zmstats[1241].INF [main:42] [Stats Daemon starting in 30 seconds]
20.12.2023 10:03:38.899915 zmstats[1241].WAR [main:69] [Failed getting user_utilization from ]
20.12.2023 10:03:38.904477 zmstats[1241].WAR [main:73] [Failed getting user_utilization from ]
20.12.2023 10:03:38.912410 zmstats[1241].DB1 [ZoneMinder::Database:254] [Succeeded INSERT INTO Server_Stats (ServerId, TimeStamp, CpuLoad, CpuUserPercent, CpuSystemPercent, TotalMem, FreeMem, TotalSwap, FreeSwap) VALUES ('',NOW(),'','0','0','16792485888','13556924416','1023406080','1023406080') : 1 rows affected]
20.12.2023 10:03:38.913375 zmstats[1241].DB1 [ZoneMinder::Database:254] [Succeeded DELETE FROM `Server_Stats` WHERE `TimeStamp` < now() - interval 1 DAY LIMIT 100 : 0E0 rows affected]
20.12.2023 10:03:38.913525 zmstats[1241].DB1 [main:83] [Deleted 0E0 Server Stats table entries by time]
20.12.2023 10:03:38.914709 zmstats[1241].DB1 [ZoneMinder::Database:254] [Succeeded DELETE FROM Monitor_Status WHERE MonitorId IN (SELECT Id FROM Monitors WHERE Capturing='None') : 0E0 rows affected]
20.12.2023 10:03:38.915549 zmstats[1241].DB1 [ZoneMinder::Database:254] [Succeeded DELETE FROM Events_Hour WHERE StartDateTime < DATE_SUB(NOW(), INTERVAL 1 hour) : 0E0 rows affected]
20.12.2023 10:03:38.916395 zmstats[1241].DB1 [ZoneMinder::Database:254] [Succeeded DELETE FROM Events_Day WHERE StartDateTime < DATE_SUB(NOW(), INTERVAL 1 day) : 0E0 rows affected]
20.12.2023 10:03:38.917199 zmstats[1241].DB1 [ZoneMinder::Database:254] [Succeeded DELETE FROM Events_Week WHERE StartDateTime < DATE_SUB(NOW(), INTERVAL 1 week) : 0E0 rows affected]
20.12.2023 10:03:38.917928 zmstats[1241].DB1 [ZoneMinder::Database:254] [Succeeded DELETE FROM Events_Month WHERE StartDateTime < DATE_SUB(NOW(), INTERVAL 1 month) : 0E0 rows affected]
20.12.2023 10:03:38.918662 zmstats[1241].DB1 [ZoneMinder::Database:254] [Succeeded DELETE FROM `Logs` WHERE `TimeKey` < unix_timestamp(now() - interval 3 day) LIMIT 100 : 0E0 rows affected]
20.12.2023 10:03:38.918781 zmstats[1241].DB1 [main:118] [Deleted 0E0 log table entries by time]
20.12.2023 10:03:38.919469 zmstats[1241].DB1 [ZoneMinder::Database:254] [Succeeded DELETE FROM Sessions WHERE access < '1703059418' LIMIT 100 : 0E0 rows affected]
20.12.2023 10:03:38.919571 zmstats[1241].DB1 [main:127] [Deleted 0E0 sessions]
20.12.2023 10:04:39.169256 zmstats[1241].WAR [main:69] [Failed getting user_utilization from ]
20.12.2023 10:04:39.178446 zmstats[1241].WAR [main:73] [Failed getting user_utilization from ]
20.12.2023 10:04:39.186257 zmstats[1241].DB1 [ZoneMinder::Database:254] [Succeeded INSERT INTO Server_Stats (ServerId, TimeStamp, CpuLoad, CpuUserPercent, CpuSystemPercent, TotalMem, FreeMem, TotalSwap, FreeSwap) VALUES ('',NOW(),'','0','0','16792485888','13308215296','1023406080','1023406080') : 1 rows affected]
20.12.2023 10:04:39.187122 zmstats[1241].DB1 [ZoneMinder::Database:254] [Succeeded DELETE FROM `Server_Stats` WHERE `TimeStamp` < now() - interval 1 DAY LIMIT 100 : 0E0 rows affected]
20.12.2023 10:04:39.187248 zmstats[1241].DB1 [main:83] [Deleted 0E0 Server Stats table entries by time]
20.12.2023 10:04:39.188349 zmstats[1241].DB1 [ZoneMinder::Database:254] [Succeeded DELETE FROM Monitor_Status WHERE MonitorId IN (SELECT Id FROM Monitors WHERE Capturing='None') : 0E0 rows affected]
20.12.2023 10:04:39.189140 zmstats[1241].DB1 [ZoneMinder::Database:254] [Succeeded DELETE FROM Events_Hour WHERE StartDateTime < DATE_SUB(NOW(), INTERVAL 1 hour) : 0E0 rows affected]
20.12.2023 10:04:39.189860 zmstats[1241].DB1 [ZoneMinder::Database:254] [Succeeded DELETE FROM Events_Day WHERE StartDateTime < DATE_SUB(NOW(), INTERVAL 1 day) : 0E0 rows affected]
20.12.2023 10:04:39.190563 zmstats[1241].DB1 [ZoneMinder::Database:254] [Succeeded DELETE FROM Events_Week WHERE StartDateTime < DATE_SUB(NOW(), INTERVAL 1 week) : 0E0 rows affected]
20.12.2023 10:04:39.191357 zmstats[1241].DB1 [ZoneMinder::Database:254] [Succeeded DELETE FROM Events_Month WHERE StartDateTime < DATE_SUB(NOW(), INTERVAL 1 month) : 0E0 rows affected]
20.12.2023 10:04:39.192419 zmstats[1241].DB1 [ZoneMinder::Database:254] [Succeeded DELETE FROM `Logs` WHERE `TimeKey` < unix_timestamp(now() - interval 3 day) LIMIT 100 : 0E0 rows affected]
20.12.2023 10:04:39.192643 zmstats[1241].DB1 [main:118] [Deleted 0E0 log table entries by time]
20.12.2023 10:04:39.193291 zmstats[1241].DB1 [ZoneMinder::Database:254] [Succeeded DELETE FROM Sessions WHERE access < '1703059479' LIMIT 100 : 0E0 rows affected]
20.12.2023 10:04:39.193418 zmstats[1241].DB1 [main:127] [Deleted 0E0 sessions]
20.12.2023 10:05:39.417661 zmstats[1241].WAR [main:69] [Failed getting user_utilization from ]
20.12.2023 10:05:39.424329 zmstats[1241].WAR [main:73] [Failed getting user_utilization from ]
20.12.2023 10:05:39.448101 zmstats[1241].DB1 [ZoneMinder::Database:254] [Succeeded INSERT INTO Server_Stats (ServerId, TimeStamp, CpuLoad, CpuUserPercent, CpuSystemPercent, TotalMem, FreeMem, TotalSwap, FreeSwap) VALUES ('',NOW(),'','0','0','16792485888','13292204032','1023406080','1023406080') : 1 rows affected]
20.12.2023 10:05:39.448992 zmstats[1241].DB1 [ZoneMinder::Database:254] [Succeeded DELETE FROM `Server_Stats` WHERE `TimeStamp` < now() - interval 1 DAY LIMIT 100 : 0E0 rows affected]
20.12.2023 10:05:39.449118 zmstats[1241].DB1 [main:83] [Deleted 0E0 Server Stats table entries by time]
20.12.2023 10:05:39.450168 zmstats[1241].DB1 [ZoneMinder::Database:254] [Succeeded DELETE FROM Monitor_Status WHERE MonitorId IN (SELECT Id FROM Monitors WHERE Capturing='None') : 0E0 rows affected]
20.12.2023 10:05:39.450973 zmstats[1241].DB1 [ZoneMinder::Database:254] [Succeeded DELETE FROM Events_Hour WHERE StartDateTime < DATE_SUB(NOW(), INTERVAL 1 hour) : 0E0 rows affected]
20.12.2023 10:05:39.451783 zmstats[1241].DB1 [ZoneMinder::Database:254] [Succeeded DELETE FROM Events_Day WHERE StartDateTime < DATE_SUB(NOW(), INTERVAL 1 day) : 0E0 rows affected]
20.12.2023 10:05:39.452691 zmstats[1241].DB1 [ZoneMinder::Database:254] [Succeeded DELETE FROM Events_Week WHERE StartDateTime < DATE_SUB(NOW(), INTERVAL 1 week) : 0E0 rows affected]
20.12.2023 10:05:39.453474 zmstats[1241].DB1 [ZoneMinder::Database:254] [Succeeded DELETE FROM Events_Month WHERE StartDateTime < DATE_SUB(NOW(), INTERVAL 1 month) : 0E0 rows affected]
20.12.2023 10:05:39.454287 zmstats[1241].DB1 [ZoneMinder::Database:254] [Succeeded DELETE FROM `Logs` WHERE `TimeKey` < unix_timestamp(now() - interval 3 day) LIMIT 100 : 0E0 rows affected]
20.12.2023 10:05:39.454430 zmstats[1241].DB1 [main:118] [Deleted 0E0 log table entries by time]
20.12.2023 10:05:39.455101 zmstats[1241].DB1 [ZoneMinder::Database:254] [Succeeded DELETE FROM Sessions WHERE access < '1703059539' LIMIT 100 : 0E0 rows affected]
20.12.2023 10:05:39.455227 zmstats[1241].DB1 [main:127] [Deleted 0E0 sessions]
Best regards
Detlef Paschke
Detlef Paschke
Posts: 27
Joined: Tue Sep 12, 2023 6:14 pm

Re: Failed getting user_utilization from

Post by Detlef Paschke »

Hello,

From what I have found so far, there must be problems for me somewhere in this area of zmstats.pl.

Code: Select all

  # Get CPU utilization percentages
  my $top_output = `top -b -n 1 | grep "^%Cpu(s)" | awk '{print \$2, \$4}'`;
  my ($user_utilization, $system_utilization) = split(/ /, $top_output);
  $user_utilization =~ s/[^\d\.]//g;
  $system_utilization =~ s/[^\d\.]//g;
  if (!$user_utilization) {
    Warning("Failed getting user_utilization from $top_output");
    $user_utilization = 0;
  }
  if (!$system_utilization) {
    Warning("Failed getting user_utilization from $top_output");
    $system_utilization = 0;
  }
In any case, grep "^%Cpu(s)" is not correct for Debian, because in Debian it says %CPU(s).
I changed this in zmstats.pl as a test, but the message continues to come every minute.

Best regards
Detlef Paschke
Detlef Paschke
Posts: 27
Joined: Tue Sep 12, 2023 6:14 pm

Re: Failed getting user_utilization from

Post by Detlef Paschke »

Detlef Paschke wrote: Wed Dec 20, 2023 7:11 pm In any case, grep "^%Cpu(s)" is not correct for Debian, because in Debian it says %CPU(s).
I changed this in zmstats.pl as a test, but the message continues to come every minute.
Hello,

The fact is that grep “^%Cpu(s)” is the cause of the problem.
It just didn't work for me right away because Zoneminder has to be restarted for a change to zmstats.pl to take effect.

I have now changed the line like this. Which means grep is not case sensitive.

Code: Select all

my $top_output = `top -b -n 1 | grep -i "^%Cpu(s)" | awk '{print \$2, \$4}'`;
Many greetings
Detlef Paschke
Post Reply