mostafamemariani / mysql-cacti-templates

Automatically exported from code.google.com/p/mysql-cacti-templates
GNU General Public License v2.0
0 stars 0 forks source link

load (type w item as) does not return correct load number. #170

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
using better-cacti-templates-1.1.7
server: Centos-5.5
client: Centos-5.5

sudo -u cacti php /usr/share/cacti/scripts/ss_get_by_ssh.php --host <client> 
--type w --items as
returns:
as:1.68

When the actual load is 11.68.

I've tracked the problem to line 827 in ss_get_by_ssh.php, the regexp is a bit 
too greedy. To fix change:
if ( preg_match_all('/(\d+) user[s]*, .*(\d+\.\d+)$/', $line, $words) ) {
to:
if ( preg_match_all('/(\d+) user[s]*, .*?(\d+\.\d+)$/', $line, $words) ) {

Original issue reported on code.google.com by gdj...@gmail.com on 17 Jan 2011 at 10:32

GoogleCodeExporter commented 8 years ago
Thanks!  Can you attach a sample output for use as a test case?

Original comment by baron.schwartz on 17 Jan 2011 at 2:05

GoogleCodeExporter commented 8 years ago
I'm guessing this is what you mean:
[root@xxxxx ~]# w
 17:25:16 up 27 days,  3:32,  2 users,  load average: 17.87, 15.63, 16.23
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
xxxxxxx  pts/0    xxxxxxxx-macbook 14:09    0.00s  0.03s  0.00s sshd: xxxxxxx 
[priv]
root     tty1     -                21Dec10 25days  0.03s  0.03s -bash

Original comment by gdj...@gmail.com on 17 Jan 2011 at 4:26

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r541.

Original comment by baron.schwartz on 22 Jan 2011 at 7:10