psychedelys/mysql-cacti-templates

load average,users shows NaN when only 1 user is logged in

Closed this issue · 1 comments

The Graphs X Load Average GT and X Number of Users GT where showing NaN as
value. 
At commandline 
/usr/bin/php -q /usr/share/cacti/site/scripts/ss_get_by_ssh.php --host
192.168.0.1 --type w --items as,at
was showing as:-1 at:-1.

I found an error in the regex in ss_get_by_ssh.php line 798.

When only 1 user is logged in, uptime will show 
12:34:33 up 19:51,  1 user,  load average: 0.00, 0.00, 0.00
when 2 or more users are logged in it will show
12:34:33 up 19:51,  2 users,  load average: 0.00, 0.00, 0.00
and that is not catched by the regex.

I changed
preg_match_all('/(\d+) users, .*(\d+\.\d+)$/', $line, $words)
to
preg_match_all('/(\d+) user.*, .*(\d+\.\d+)$/', $line, $words)
and it worked fine.

I'm using cacti 0.8.7b with better-cacti-templates 1.1.6 on Debian Lenny in
openvz container.

Original issue reported on code.google.com by kforo...@gmail.com on 13 Mar 2010 at 12:36

This issue was closed by revision r432.

Original comment by baron.schwartz on 21 Mar 2010 at 1:36

  • Changed state: Fixed